Hello,
I have an bitmap in a resources file containing all icons displayed in
the toolbar. To display the icons I need to cut them out of the bitmap
and add them to an imagelist. The problem is the cutting out. I wrote
the following function:
[vb]
Public Shared Function CutOutIcon(ByRef vBitmap As Image, _
ByVal iIndex As Integer) As Image
Try
Dim Bmp2 As Bitmap = New Bitmap(32, 32)
Dim GFX As Graphics = Graphics.FromImage(Bmp2)
GFX.DrawImage(vBitmap, 0, 0, New Rectangle(iIndex * 32,_
0, 32, 32), GraphicsUnit.Pixel)
Return New Bitmap(32, 32, GFX)
Catch ex As Exception
End Try
End Function
[/vb]
vBitmap contains the pic from the resource (it really does, I checked
it). But all I get is a blank image.
What am I doing wrong?
Thanks in advance,
Stefan
--
___________________________________www.VBTricks.de .vu
the free resource for Visual Basic, Gambas and Pascal
components, tips & complete projects
www: http://www.VBTricks.de.vu
mail: vbtricks <at> gmx <dot> net
__________________________________________________ ___