I have a customized exception handler that opens a form with a detailed error information and an option to email the error report. I want to use Wisej MessageBoxIcon instead of an old 3-d gif file I used before. I tried to use:
pictureBox1.Image = System.Drawing.SystemIcons.Error.ToBitmap(). It works but id doesn’t give me the one used by Wisej. I also tried
pictureBox1.Image = Wisej.Web.MessageBoxIcon.Error.????? but I am stuck on how to convert it into an image.
You can set the ForeColor property of the picture box. If you want to use the colors from the theme you can set the color to a named theme color, or simply use any other color. To use a theme color do this:
this.pictureBox1.ForeColor = Color.FromName(“invalid”);
If there is a name mismatch, you can ensure that it uses the theme color like this:
this.pictureBox1.ForeColor = Color.FromName(“@invalid”);
This is how Wisej handles SVG icons and images vs. font icons:
Use pictureBox1.ImageSource=”messagebox-error”. Check in the theme file for the different icon names under “images”.
The name after “messagebox-” corresponds to the MessageBoxIcon enum. But you can use any theme image name in ImageSource.
Got it working using the ForeColor property and the built-in theme. There is no such property in WinForm and I was surprised.
Yes! It works. But…the image fill-color is black. I saw the right color in Appearances.MessageBox.Image.<MessabeBoxIcon enum>.properties.textColor. Is there a way I can use them and how?
Actually, I’ve already changed the fill-color of those images, replaced messagebox-* in the file and it’s working. But I would prefer to use whatever is the value in the theme file, if possible. And I really do not know how it would affect other parts of Wisej that use those images after replacing them.