From: K on
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


From: James Hahn on
Dim img1 As New Bitmap(16, 16, Imaging.PixelFormat.Format32bppArgb)
Dim g As Graphics = Graphics.FromImage(img1)
g.DrawImage(img, New Rectangle(0, 0, 16, 16), New Rectangle(0, 0,
img.Width, img.Height), GraphicsUnit.Pixel)
img1 = New Bitmap(32,32, Imaging.PixelFormat.Format32bppArgb)
Dim g As Graphics = Graphics.FromImage(img1)
g.DrawImage(img, New Rextangle(0, 0, 32, 32), New Rectangle(0, 0,
img.Width, img.Height), GraphicsUnit.Pixel)

"K" <kamranr1982(a)yahoo.co.uk> wrote in message
news:17114dd2-3dd5-4db8-a65d-737a0c6f41e0(a)h2g2000yqj.googlegroups.com...
> 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
>
>

From: K on
Hi James, Thanks for replying. You didnt mention in your code that
where to get image from as in my code i am getting it from PictureBox.