471,851 Members | 979 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,851 software developers and data experts.

Get image from MessageBoxIcon

I want use icons available in MessageBoxIcon to use them in a PictureBox
control.

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
Jun 27 '08 #1
6 14136
"Rui Oliveira" <Ru*********@discussions.microsoft.comwrote:
I want use icons available in MessageBoxIcon to use them in a
PictureBox control.
Use the SystemIcons class.

Eq.
Jun 27 '08 #2
On May 12, 2:16*pm, Rui Oliveira
<RuiOlive...@discussions.microsoft.comwrote:
I want use icons available in MessageBoxIcon to use them in a PictureBox
control.

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
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.
Jun 27 '08 #3
On May 12, 3:43*pm, "Paul E Collins" <find_my_real_addr...@CL4.org>
wrote:
"Rui Oliveira" <RuiOlive...@discussions.microsoft.comwrote:
I want use icons available in MessageBoxIcon to use them in a
PictureBox control.

Use the SystemIcons class.

Eq.
That is also possible, in this case you would have to convert it to a
bitmap:
myPictureBox.Image = Bitmap.FromHicon(SystemIcons.Hand.Handle);
Jun 27 '08 #4
"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote:
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.
Jun 27 '08 #5
On Mon, 12 May 2008 13:43:38 -0700, Paul E Collins
<fi******************@CL4.orgwrote:
"Ignacio Machin ( .NET/ C# MVP )" <ig************@gmail.comwrote:
>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
Jun 27 '08 #6
"Peter Duniho" <Np*********@nnowslpianmk.comwrote:
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.
Jun 27 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul Jaeger | last post: by
8 posts views Thread by Dennis C. Drumm | last post: by
2 posts views Thread by Corobori | last post: by
1 post views Thread by sympatico | last post: by
3 posts views Thread by Danny Ni | last post: by
NeoPa
reply views Thread by NeoPa | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.