API bitmap question

Try this.
Code:
		Public Shared Function CreateBitmap(ByVal icon As Icon) As Bitmap
			Dim gDest As Graphics, gSrc As Graphics
			Dim tmp As Bitmap
			Dim hdcDest As IntPtr
			Dim hdcSrc As Integer, hdcSrc2 As IntPtr
			Dim hWnd As Integer = icon.Handle.ToInt32
			gSrc = gSrc.FromImage(icon.ToBitmap())
			tmp = New Bitmap(icon.Width, icon.Height)
			gDest = gDest.FromImage(tmp)
			hdcSrc2 = gSrc.GetHdc
			hdcSrc = hdcSrc2.ToInt32()
			hdcDest = gDest.GetHdc
			Win32.BitBlt(hdcDest.ToInt32, 0, 0, icon.Width, icon.Height, hdcSrc, 0, 0, Win32.SRCCOPY)
			gDest.ReleaseHdc(hdcDest)
			gSrc.ReleaseHdc(hdcSrc2)
			Win32.ReleaseDC(hWnd, hdcSrc)

			Return tmp
		End Function
 
Unfortunately this gives the same result. It returns an empty bitmap!!!!

Are there no real API mans here on the forum??
 
Why cant you just use the Icon.ToBitmap() function (or whatever its called)?
It seems that this is what youre trying to implement.
 
Hes refusing to keep the icons in icon format, as they were intended. If he would just do this, no quality loss would occur.
 
Back
Top