Drawing to a Memory Bitmap for Faster Performance

ID: Q130805


The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) 3.1
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows 95
    • Microsoft Windows NT 3.5
    • Microsoft Win32s version 1.25
  • Microsoft Windows 2000


SUMMARY

An application whose client area is a complex image can realize a performance benefit from drawing to a memory bitmap. The complex, time consuming drawing code need only be performed once - to initialize the offscreen bitmap. During the handling of the WM_PAINT message, the only work that needs to be done is a simple BitBlt from the memory bitmap to the screen.

Sample code demonstrating this technique is available in the Microsoft Software Library. The MemDC sample code draws a complex pattern on its client area. A menu option toggle allows the user to see the speed difference between using and not using the offscreen bitmap.


MORE INFORMATION

The following files are available for download from the Microsoft Download Center. Click the file names below to download the files:


Memdc.exe

For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address

http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.

Additional query words: device context memory DC speed fast buffer kbfile kbgraphic

Keywords : kbfile kbgraphic kbNTOS350 kbWinOS2000 kbSDKWin32 kbWinOS95
Version : WINDOWS:1.25,3.1,95; winnt:3.5
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: December 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.