Using system images in C #

I am creating a custom mailbox. How to use system images such as Error , Information , Warning , etc. that I see in MessageBox windows? I want to access them directly!

+6
c #
source share
3 answers

Take a look at System.Drawing.SystemIcons . You must find them there.

Then install the PictureBox (assuming Winforms here) as follows:

 PictureBox1.Image = System.Drawing.SystemIcons.Warning.ToBitmap(); 
+19
source share

You need to look a little further into the message class. You can specify "MessageBoxIcon" when calling the method.

There are some good examples of how to achieve this here: http://www.dotnetperls.com/messagebox-show

0
source share

You can draw system icons in your custom MessageBox by handling the Paint event, for example.

 void MyMessageBox_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawIcon(SystemIcons.Warning, 16, 16); } 
0
source share

All Articles