0

I am trying to create a custom message box. I followed this question’s answer. I want to add an ability to add a MessageBoxIcon just like in the default MessageBox. I’ve added a PictureBox but what location do I browse to use those default icons (warning, error, stop, info etc)?

haku
  • 4,105
  • 7
  • 38
  • 63
  • In a quick and dirty search I found that some are within shell32.dll, as icon resources. Still haven't found all of them, but that library seems like a good starting point. – Alejandro Sep 13 '18 at 14:54
  • 1
    Check out [`SystemIcons`](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.systemicons?view=netframework-4.7.2) class – Ivan Stoev Sep 13 '18 at 14:57
  • MessageBox is not implemented in .NET, it is merely a wrapper for [the OS function](https://learn.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-messagebox). Those icons used to be stored in user32.dll, but it got convoluted in recent Windows versions that support MUI resources. Yes, use the SystemIcons class. – Hans Passant Sep 13 '18 at 15:01
  • thank-you guys. It seems like an duplicate to the question you pointed out. – haku Sep 13 '18 at 15:02
  • For others who may run into this problem in the future, just need to do pictureBox1.Image = SystemIcons.Warning.ToBitmap(); – haku Sep 13 '18 at 15:47

0 Answers0