473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 14672
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Jaeger | last post by:
I have jpeg images that are 2848 x 4256 pixels. I want to programatically convert them to images that are approximately 427 x 638 (that maintains the ratio) and save to new jpeg files. How can...
8
by: Dennis C. Drumm | last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost Win32 API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom...
2
by: Bradley1234 | last post by:
Seems simple but Im missing something. In a C# form Ive got a picturebox and a button I have the File Open dialog linked to the button, but Im drawing a blank on how to take the stream and push...
2
by: Corobori | last post by:
I am getting an error message "Description: Value cannot be null. Parameter name: encoder" when performing this instruction: frmPicView.pic.Image.Save(ms, frmPicView.pic.Image.RawFormat) Here is...
1
by: sympatico | last post by:
Hi, I am trying to compare 2 images to check if they are exactly identical (in terms of data), I thought this would be quicker than analysing pixels of the images. I have found lots of examples...
19
by: **Developer** | last post by:
When I get the image from the file the file remains locked so the Delete fails with a "used by another process" So I tried using a clone and disposing the obtained image. But that didn't fix...
4
by: escristian | last post by:
Hello. I'm trying to create an Image so I use something like this: Image newImage = Image.FromFile(filename); Now when it's a bmp file and certain .gif files it gives me an exception that...
1
by: sergiotb | last post by:
Hello everyone!! I'm trying to send a image (jpg) from a C# program to a CGI perl. The problem is that the code of the client C# is not working properly...I guess. The steps to send the image are: 1)...
3
by: Danny Ni | last post by:
Hi, I am looking for a way to display images with different aspect ratio into frames with fixed width and height, the problem is some images will look distorted if they are forced into fixed...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.