By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

Get a form's small icon

P: n/a
I wish to be able to copy a form's icon into a picturebox, in a similar way
to how the Windows Taskbar copies each form's icon into each of its task
panels.

I can easily read out the icon of each form by querying the .Icon property.
However, when I use the Graphics.DrawIcon method to draw this into my
picturebox, it is clearly the "large" version of the icon that is being
drawn. When I draw it with a size of 16x16 pixels, the icon is visibly
distorted compared to the original displayed in the window itself; when I
draw at 32x32 the image is fine and undistorted, but twice the size that I
want it to be.

If there a way for me to extract the small icon for each form so that I can
draw it without it distorting?

Thanks in advance,

--

(O)enone
Sep 17 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can try using the overlaoded constructor :
Icon Constructor (Icon, Size) : Initializes a new instance of the Icon class
and attempts to find a version of the icon that matches the requested size.
---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------

"(O)enone" <oe****@nowhere.comwrote in message
news:eH***************@TK2MSFTNGP06.phx.gbl...
>I wish to be able to copy a form's icon into a picturebox, in a similar way
to how the Windows Taskbar copies each form's icon into each of its task
panels.

I can easily read out the icon of each form by querying the .Icon
property. However, when I use the Graphics.DrawIcon method to draw this
into my picturebox, it is clearly the "large" version of the icon that is
being drawn. When I draw it with a size of 16x16 pixels, the icon is
visibly distorted compared to the original displayed in the window itself;
when I draw at 32x32 the image is fine and undistorted, but twice the size
that I want it to be.

If there a way for me to extract the small icon for each form so that I
can draw it without it distorting?

Thanks in advance,

--

(O)enone

Sep 19 '07 #2

P: n/a
G Himangi wrote:
You can try using the overlaoded constructor :
Icon Constructor (Icon, Size) : Initializes a new instance of the
Icon class and attempts to find a version of the icon that matches
the requested size.
That works perfectly -- many thanks!

--

(O)enone
Sep 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.