- size_t nCheckWidth = GetDefaultMarginWidth(),
- nCheckHeight = m_pParent->GetItemHeight();
-
- int x = rc.GetX(),
- y = rc.GetY();
-
- HDC hdc = (HDC)dc.GetHDC();
-
- // create pens, brushes &c
- COLORREF colBg = ::GetSysColor(COLOR_WINDOW);
- AutoHPEN hpenBack(colBg),
- hpenGray(RGB(0xc0, 0xc0, 0xc0));
-
- SelectInHDC selPen(hdc, (HGDIOBJ)hpenBack);
- AutoHBRUSH hbrBack(colBg);
- SelectInHDC selBrush(hdc, hbrBack);
-
- // erase the background: it could have been filled with the selected colour
- Rectangle(hdc, x, y, x + nCheckWidth + 1, rc.GetBottom() + 1);
-
- // shift check mark 1 pixel to the right, looks better like this
- x++;
-
- if ( IsChecked() )
- {
- // first create a monochrome bitmap in a memory DC
- MemoryHDC hdcMem(hdc);
- MonoBitmap hbmpCheck(nCheckWidth, nCheckHeight);
- SelectInHDC selBmp(hdcMem, hbmpCheck);
-
- // then draw a check mark into it
- RECT rect = { 0, 0, nCheckWidth, nCheckHeight };
- ::DrawFrameControl(hdcMem, &rect,
-#ifdef __WXWINCE__
- DFC_BUTTON, DFCS_BUTTONCHECK
-#else
- DFC_MENU, DFCS_MENUCHECK
-#endif
- );