PictureBox and SystemIcons

G

Guest

I have a form on which I want to display one of Icons from the SystemIcons class. I have done so using a PictureBox, something like...

PictureBox pictureBox = new PictureBox();
....
pictureBox.Image = SystemIcons.Question.ToBitmap();

This does display the Icon but it is a bit 'choppy' and simply does not look as nice as when the same icon is displayed using MessageBox.Show( ...., MessageBoxIcons.Question, ...)

Any ideas? Is there a better way to do this? Something besides the PictureBox class.
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?RGFuIFM=?= said:
I have a form on which I want to display one of Icons from the SystemIcons class. I have done so using a PictureBox, something like...

PictureBox pictureBox = new PictureBox();
...
pictureBox.Image = SystemIcons.Question.ToBitmap();

This does display the Icon but it is a bit 'choppy' and simply does not look as nice as when the same icon is displayed using MessageBox.Show( ...., MessageBoxIcons.Question, ...)

<URL:http://dotnetrix.co.uk/>
-> "Tips" -> "Misc..."
 
W

Wiktor Zychla

This does display the Icon but it is a bit 'choppy' and simply does not
look as nice as when the same icon is displayed using MessageBox.Show( ....,
MessageBoxIcons.Question, ...)

are you sure that the PictureBox does not automatically scale the icon image
to its own size? if it is so then the icon could really look ugly. make sure
that the picture box size is the same as the icon beeing painted. another
solution would be to override form's OnPaint and paint the icon directly on
the form using Graphics.DrawImageUnscaled(...).

regards,
Wiktor Zychla
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top