How can I do this?
There are a way to get this icons from MessageBoxIcon, or I need to have
this images saved in a files to use them in a PictureBox control?
Thks,
Rui Oliveira
> I want use icons available in MessageBoxIcon to use them in a
> PictureBox control.
Use the SystemIcons class.
Eq.
Hi,
I do not think you can do that, that is simply an enumerator.
You have two options:
1- Take a peek in the code of MessageBox control and see how/from
where it gets the image from.
2- Copy the image you want and create your own copy of it. You can use
Print Screen, msPaint to sae just the piece you need.
That is also possible, in this case you would have to convert it to a
bitmap:
myPictureBox.Image = Bitmap.FromHicon(SystemIcons.Hand.Handle);
> That is also possible, in this case you would have to convert it to a
> bitmap:
> myPictureBox.Image = Bitmap.FromHicon(SystemIcons.Hand.Handle);
But then you lose the transparent background and get ugly black edges.
Here's what I use (in the Paint method):
e.Graphics.DrawIcon(SystemIcons.Exclamation, 0, 0);
Eq.
> "Ignacio Machin ( .NET/ C# MVP )" <ignacio...@gmail.com> wrote:
>
>> That is also possible, in this case you would have to convert it to a
>> bitmap:
>> myPictureBox.Image = Bitmap.FromHicon(SystemIcons.Hand.Handle);
>
> But then you lose the transparent background and get ugly black edges.
Really? That's annoying. I would have expected FromHicon() to include
alpha in the new Bitmap so that the transparency isn't lost.
One _should_ still be able to do it though, by making a regular 32bpp
Bitmap, clearing it with Color.Transparent, and then drawing the icon into
it with DrawIcon(). Then you only have to do it once, rather than
overriding OnPaint() or handling the Paint event.
Pete
> > But then you lose the transparent background and get ugly black
> > edges.
>
> Really? That's annoying. I would have expected FromHicon() to
> include alpha in the new Bitmap so that the transparency isn't lost.
The 100% transparent parts are okay, but the translucency isn't, so the
"drop shadow" comes out as pure black instead of a soft fade. (That's in
VS2005, anyway.)
Eq.