My scenario here is to display a critical error icon on my custom dialogue box form. In case if we are showing a System.Windows.Forms.MessageBox, we can pass the parameter as ' MessageboxIcon.Error ' and it will show the error icon on the messagebox.
But my requirement here is different.
So, I placed a PictureBox control on the form, named 'pcIcon', and painted it with SystemIcons.Error.
PictureBox has an event called Paint. We can handle that and it is there we have to paint it with our desired image.
Call ShowDialog() method of the designed form, optionally passing the 'owner' parameter as 'Me' (in vb) / 'This' (in c#).
But my requirement here is different.
So, I placed a PictureBox control on the form, named 'pcIcon', and painted it with SystemIcons.Error.
Design:
PictureBox has an event called Paint. We can handle that and it is there we have to paint it with our desired image.
Code:
Finally the displayed Custom Dialogue Box with Error Icon :
Call ShowDialog() method of the designed form, optionally passing the 'owner' parameter as 'Me' (in vb) / 'This' (in c#).
No comments:
Post a Comment