[SOLVED] MessageBoxIcon as PictureBox Image

Answered Closed
0
0

Hi,

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.

Thanks.

 

  • You must to post comments
Best Answer
0
0

Hi Cris,

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:

  • SVG icons are typically black since they use the fill color property to fill the icon.
  • SVG colored icons can use any color in addition to the “dynamic” fill color.
  • Font icons (which are inherently a hack devised years ago when browsers didn’t fully support svg images) are always mono color. You can’t have colored font icons.
  • Wisej preloads the svg icons and caches them as xml documents. When the svg image is used on a widget, wisej changes the fill color to use the widget’s text color. If the icon is monochrome it will adapt to the text color, otherwise it’s unchanged.
  • Additionally, if the icon is used as a background image, Wisej can set the css fill color value using the style value from the theme.

HTH

Best,

Luca

  • You must to post comments
Great Answer
0
0

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.

Best,

Luca

  • You must to post comments
0
0

Hi Luca,

Got it working using the ForeColor property and the built-in theme. There is no such property in WinForm and I was surprised.

Thanks.

  • You must to post comments
0
0

Hi Luca,

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.

Thanks.

  • You must to post comments
Showing 4 results