Public static DialogResult Popup (Form Form, string Detail, string Title="message", ButtonStyle button=ButtonStyle. OK, ShowIcon Icon=ShowIcon. None)
{
Var LabelDetail=form. Controls. The Find (" LabelDetail ", false) [0] the as System. Windows. Forms. The Label;
Var ButtonOK=form. Controls. The Find (" ButtonOK ", false) [0] the as System. Windows. Forms. The Button;
Var ButtonCanecl=form. Controls. The Find (" ButtonCancel ", false) [0] the as System. Windows. Forms. The Button;
Above three, can find direct control, and then the corresponding operation,
But this not line, say not packing operation, such as
I have put in the form of pre-made imaglist, also put the icon, to simulate the reality of different icon
That how to found in the form imagelist?
????
Var ImageList=form. Controls. The Find (" IconImageList ", false) [0] as ImageList
}
CodePudding user response:
What are you in the further, is necessary for prompt box icon manual packing?Windows. The Form or DevExpress. XtraEditors, there are ready-made boxing icon and MessageBoxButtons,
For example:
Public static DialogResult ShowTipe (string message)
{
Return MessageBox. Show (the message, "message", MessageBoxButtons. OK, MessageBoxIcon. Information);
}
///& lt; Summary>
///show the general message
///& lt;/summary>
///& lt; Param name="message" & gt; Prompt information & lt;/param>
Public static DialogResult ShowTips (string message)
{
Return DevExpress. XtraEditors. XtraMessageBox. Show (the message, "message", MessageBoxButtons. OK, MessageBoxIcon. Information);
}
CodePudding user response:
I just want to use your own icon to try to simulateAnd this is a blind spot of knowledge, is to learn,
CodePudding user response:
Either you open directly, or reflections,CodePudding user response:
Form Form=yourForm;
Var images=form. GetType (). The GetFields (BindingFlags. Public | BindingFlags. NonPublic | BindingFlags. Instance), Where (f=& gt; F.F ieldType==typeof (ImageList).) FirstOrDefault ();
CodePudding user response:
(images. GetValue (form) as ImageList). The images [0]
CodePudding user response:
ImageList is Component, not Control, so you can't find in Controls