J
Joergen Bech
Suppose I have
Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed)
I cannot use
Dim g As Graphics = Graphics.FromImage(bmdest)
Dim hdc As IntPtr = g.GetHdc()
as the FromImage call will fail for indexed bitmaps.
How do I get a device context handle (hdc) to this bitmap so I can
draw on it using GDI (not GDI+) functions, such as RoundRect, etc?
Note: I do *not* want to convert the image to 24-bit, then go the
usual GDI+ route, then convert it back to 8-bit. I want to *stay* in
8-bit mode.
Also note that I am not looking for solutions that create a new
bitmap using GDI functions. One of the things I need to do is to
take to bitmap parameters, obtain hdc's for both, then use those
to draw one of the bitmaps on top of the other using BitBlt or
StretchBlt. The sample bitmap object above is just an example
of the format I need to be able to handle.
TIA,
Joergen Bech
Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed)
I cannot use
Dim g As Graphics = Graphics.FromImage(bmdest)
Dim hdc As IntPtr = g.GetHdc()
as the FromImage call will fail for indexed bitmaps.
How do I get a device context handle (hdc) to this bitmap so I can
draw on it using GDI (not GDI+) functions, such as RoundRect, etc?
Note: I do *not* want to convert the image to 24-bit, then go the
usual GDI+ route, then convert it back to 8-bit. I want to *stay* in
8-bit mode.
Also note that I am not looking for solutions that create a new
bitmap using GDI functions. One of the things I need to do is to
take to bitmap parameters, obtain hdc's for both, then use those
to draw one of the bitmaps on top of the other using BitBlt or
StretchBlt. The sample bitmap object above is just an example
of the format I need to be able to handle.
TIA,
Joergen Bech