--- cmdlgtst.c +++ cmdlgtst.c @@ -245,6 +245,30 @@ void mwi_InitAll(HWND hWnd) mwi_FindReplace(hWnd); } +void myDrawFocusRect( HDC hdc, const RECT* rc ) +{ + HBRUSH hOldBrush; + HPEN hOldPen, hNewPen; + INT oldDrawMode, oldBkMode; + COLORREF oldBkColor; + + hOldBrush = SelectObject(hdc, GetStockObject(NULL_BRUSH)); + hNewPen = CreatePen(PS_DASHDOTDOT, 1, RGB(0, 0, 0)); + hOldPen = SelectObject(hdc, hNewPen); + oldDrawMode = SetROP2(hdc, R2_XORPEN); + oldBkColor = SetBkColor(hdc, RGB(0, 255, 255)); + oldBkMode = SetBkMode(hdc, OPAQUE); + + Rectangle(hdc, rc->left, rc->top, rc->right, rc->bottom); + + SetBkMode(hdc, oldBkColor); + SetBkMode(hdc, oldBkMode); + SetROP2(hdc, oldDrawMode); + SelectObject(hdc, hOldPen); + DeleteObject(hNewPen); + SelectObject(hdc, hOldBrush); +} + /* * Various configurations for the window. Ideally, this * would be stored with the window itself, but then, this @@ -312,6 +336,12 @@ void paintMainWindow(HWND hWnd, UINT iMe font = (HFONT) SelectObject(ps.hdc, font); DeleteObject(font); + rect.left += 10; + rect.right -= 10; + rect.top += 10; + rect.bottom -= 10; + myDrawFocusRect(ps.hdc, &rect); + EndPaint(hWnd, &ps); }