[python-win32] drawing a bitmap
mhammond at skippinet.com.au
Fri Apr 22 07:50:58 CEST 2005
> hi, i can't seem to create a bitmap in memory using pywin32.
> my assert
> fails, telling me that the bitmap size is (0,0)?
I'm no expert on GDI programming at all. However, I have code that works
that looks like:
hdcBitmap = win32gui.CreateCompatibleDC(0)
hdcScreen = win32gui.GetDC(0)
hbm = win32gui.CreateCompatibleBitmap(hdcScreen, size_x, size_y)
hbmOld = win32gui.SelectObject(hdcBitmap, hbm)
# draw on hbm
# hbm can now be used.
That appears subtly different. The code is from
win32\Demos\win32gui_menu.py - it draws some bitmaps on menus.
More information about the Python-win32