- if ( IsChecked() ) {
- // first create a monochrome bitmap in a memory DC
- HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hbmpCheck = CreateBitmap(nCheckWidth, nCheckHeight, 1, 1, 0);
- HBITMAP hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmpCheck);
-
- // then draw a check mark into it
-
- RECT rect;
- rect.left = 0;
- rect.top = 0;
- rect.right = nCheckWidth;
- rect.bottom = nCheckHeight;
-
-#ifdef __WXWINCE__
- DrawFrameControl(hdcMem, &rect, DFC_BUTTON, DFCS_BUTTONCHECK);
-#else
- DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
-#endif
-
- // finally copy it to screen DC and clean up
- BitBlt(hdc, x, y, nCheckWidth - 1, nCheckHeight,
- hdcMem, 0, 0, SRCCOPY);
+ // then draw a check mark into it
+ {
+ SelectInHDC selBmp(hdcMem, hBmpCheck);