HighTechTalks DotNet Forums  

Display An Icon

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Display An Icon in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Herman Jones
 
Posts: n/a

Default Display An Icon - 05-07-2007 , 08:51 AM






I’ve got the name of a file that contains icons and the icon index. How do I
use these to display an icon in a picturebox in a .Net program?

Let’s say that the icon I want is in "c:\Program Files\Windows
NT\Accessories\wordpad.exe" and the index is 2. I think that I need to do
something like this in the “Paint” event:
Private Sub PictureBox1_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles PictureBox1.Paint

e.Graphics.DrawIcon(_
New Icon("C:\Program Files\Windows NT\Accessories\wordpad.exe"), _
0, 0)
End Sub

Of course this doesn’t work. The “Icon” constructor only takes the name of
a .ico file and it only lets you specify the size of the icon, not the index.
How do I create the “Icon” object from any type of file that contains an
icon (.ico, .exe, .dll, etc.)?


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.