Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Save Icon in different sizes

1 view
Skip to first unread message

K

unread,
Feb 16, 2010, 5:51:25 AM2/16/10
to
Hi all, I am using Visual Basic 2008. I have Visual Basic code (see
below) which changes the Form icon image with PictureBox image. My
question is that what code line I should use in code below that I can
save this icon on a path in different sizes like 16 x 16 or 32 x 32
etc. Please can any friend can help

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim img As New Bitmap(PictureBox1.Image)
Dim g As Graphics = Graphics.FromImage(img)
g.DrawImage(img, 0, 0)
Dim Hicon As IntPtr = img.GetHicon
Dim newicon As Icon = System.Drawing.Icon.FromHandle(Hicon)
Me.Icon = newicon
DestroyIcon(newicon.Handle)
End Sub


Herfried K. Wagner [MVP]

unread,
Feb 24, 2010, 8:06:04 PM2/24/10
to
Am 16.02.2010 11:51, schrieb K:
> Hi all, I am using Visual Basic 2008. I have Visual Basic code (see
> below) which changes the Form icon image with PictureBox image. My
> question is that what code line I should use in code below that I can
> save this icon on a path in different sizes like 16 x 16 or 32 x 32
> etc.

You may want to use this library (untested):

IconLib - Icons Unfolded (MultiIcon and Windows Vista supported) -
CodeProject
<URL:http://www.codeproject.com/KB/cs/IconLib.aspx>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

0 new messages