void Ctl_EraseBackground( HWND hWnd, HDC hDC, LPRECT lpRect, WORD wType ) /***********************************************************************/ { HBRUSH hBrush; hBrush = Ctl_GetBackgroundBrush( hWnd, hDC, wType ); FillRect( hDC, lpRect, hBrush ); }
void Ctl_EraseBackground( HWND hWnd, HDC hDC, LPRECT lpRect, WORD wType ) /***********************************************************************/ { HBRUSH hBrush; BOOL fCreatedBrush = FALSE; hBrush = Ctl_GetBackgroundBrush( hWnd, hDC, wType ); if ((int)hBrush-1 <= 20/*COLOR_ENDCOLORS*/) { hBrush = CreateSolidBrush( GetSysColor((int)hBrush-1) ); fCreatedBrush = TRUE; } FillRect( hDC, lpRect, hBrush ); if (fCreatedBrush) DeleteObject(hBrush); }
void Ctl_DrawButton ( HWND hWindow, HDC hDC, LPRECT lpRect, WORD wStyle, WORD wState) /***********************************************************************/ { int cxBorder = GetSystemMetrics (SM_CXBORDER); int cyBorder = GetSystemMetrics (SM_CYBORDER); HBRUSH hBrush, hOldBrush; RECT rFrame = *lpRect; if (!(wStyle & BMS_NOBORDER)) { hBrush = CreateSolidBrush (RGB(0,0,0)); hOldBrush = (HBRUSH)SelectObject (hDC,hBrush); FrameRect (hDC,&rFrame,hBrush); if (wStyle & BMS_ROUNDCORNERS) { HBRUSH hBkgd = Ctl_GetBackgroundBrush( hWindow, hDC, CTLCOLOR_BTN ); SelectObject (hDC,hBkgd); PatBlt (hDC,rFrame.left,rFrame.top,cxBorder,cyBorder,PATCOPY); PatBlt (hDC,rFrame.left,rFrame.bottom,cxBorder,-cyBorder,PATCOPY); PatBlt (hDC,rFrame.right,rFrame.top,-cxBorder,cyBorder,PATCOPY); PatBlt (hDC,rFrame.right,rFrame.bottom,-cxBorder,-cyBorder,PATCOPY); SelectObject (hDC,hBrush); } InflateRect (&rFrame,-cxBorder,-cyBorder); if (wStyle & BMS_DBLBORDER) { FrameRect (hDC,&rFrame,hBrush); InflateRect (&rFrame,-cxBorder,-cyBorder); } SelectObject (hDC,hOldBrush); DeleteObject (hBrush); } if (wState == BMS_UP) { Ctl_DrawBtnBevel (hDC, rFrame,(WORD)(wStyle & BMS_THINBEVEL ? 1 : 2)); InflateRect (&rFrame,(wStyle & BMS_THINBEVEL ? -1 : -2)*cxBorder, (wStyle & BMS_THINBEVEL ? -1 : -2)*cyBorder); if (wStyle & BMS_WINDOWSBEVEL && !(wStyle & BMS_THINBEVEL)) { rFrame.left--; rFrame.top--; } } else if (wState == BMS_DOWN || wState == BMS_SELECTED) { if (wState == BMS_SELECTED) hBrush = CreateSolidBrush (RGB(0,0,0)); else hBrush = CreateSolidBrush (GetSysColor(COLOR_BTNSHADOW)); hOldBrush = (HBRUSH)SelectObject (hDC,hBrush); PatBlt (hDC,rFrame.left,rFrame.top,cxBorder, (rFrame.bottom-rFrame.top),PATCOPY); PatBlt (hDC,rFrame.left,rFrame.top,(rFrame.right-rFrame.left), cyBorder,PATCOPY); SelectObject (hDC,hOldBrush); DeleteObject (hBrush); rFrame.left += cxBorder; rFrame.top += cyBorder; } if (wState == BMS_SELECTED) hBrush = CreateSolidBrush (GetSysColor(COLOR_BTNSHADOW)); else hBrush = CreateSolidBrush (GetSysColor(COLOR_BTNFACE)); hOldBrush = (HBRUSH)SelectObject (hDC,hBrush); PatBlt (hDC,rFrame.left,rFrame.top,rFrame.right - rFrame.left, rFrame.bottom - rFrame.top,PATCOPY); SelectObject (hDC,hOldBrush); DeleteObject (hBrush); }