Bitblt in VB.net

Before you use GDI objects on a dc, you have to select them in to it. If you want to use a pen, bitmap, brush or whatever, you select them in to the device context with SelectObject. That api returns a handle to the last object, which you should always restore when youre done using SelectObject again.
 
If you are using SelectObject() on a DC that you have created yourself that youll delete at the end of the sub, and dont plan on using the previously selected object any more, it is safe to delete it.
Code:
DeleteObject(SelectObject(hDc, hGdiObject))
 
Last edited by a moderator:
Personally I wouldnt deviate from the recommended way. Especially when VolteFace says you should :P
 
Back
Top