473,396 Members | 2,018 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,396 software developers and data experts.

Get a form's small icon

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
2 1586
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vic | last post by:
I am trying to change an icon associated with my application's main form and the application itself. 1. I selected my main form in IDE "Solution" tab and went to "Properties" window. 2. I found...
19
by: Oliver Neumann | last post by:
Hello, im new to c# and i got an app with a notifyicon. Now i want to start the app only with the notifyIcon, so that the Main-Form doesnt show up. The form itself is used at the entrance...
1
by: Lou | last post by:
How do I the small icon from a file Example: Myapp.exe I need to get the files small icon in vb6 i did Dim file_data As New CFileInfo file_data.Icon()
4
by: - Dan - | last post by:
I have an assembly that opens minimised and uses a notify icon in the system tray. IN the new() I have Me.ShowInTaskbar = False and when the form loads I use Me.WindowState =...
1
by: Brett | last post by:
How can I change the icon of a form? This is the icon that appears in the upper left corner. Thanks, Brett
3
by: Nina | last post by:
Hi there, I assigned icon for a window's form using form's Icon property at design time. Now I want to change the icon. I tried to replace the old icon with the new icon using form's Icon...
1
by: Rich | last post by:
Hello, I noticed a round looking icon with a downward chevron symbol immediately to the left of the control box on the form title bar. When I click it the form seems to unload - whether in...
3
by: Ian | last post by:
I have a form with a sub form, on the continues sub for I want to display some data along with a picture, on the On Current event I have the code: .Picture = Nz() is the name of the picture...
2
by: jp2group | last post by:
I have a Main Form that hides in the Task Bar Tray as an Icon until one of the Tray Icon's Menu Items is selected. (think of your antivirus program running there) The program starts up fine and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.