12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- // CheckBoxExt.cpp: implementation of the CGroupBoxExt class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "GroupBoxExt.h"
- #include "library.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- WNDPROC CGroupBoxExt::m_cWndProc = NULL;
- int CGroupBoxExt::pos =0;
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- LRESULT CGroupBoxExt::DefWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
- {
- CPoint point;
- LRESULT lReturn;
-
- switch( message )
- {
- case WM_ERASEBKGND:
- return 1;
- /* case WM_SIZE:
- CallWindowProc( m_cWndProc, hWnd, message, wParam, lParam );
- OnPaint( hWnd );
- return 1;*/
- case WM_PAINT:
- CallWindowProc( m_cWndProc, hWnd, message, wParam, lParam );
- OnPaint( hWnd );
- return 1;
- case WM_SETTEXT: // 设置窗口文本
- lReturn = (LONG) CallWindowProc( m_cWndProc, hWnd, message, wParam, lParam );
- OnPaint( hWnd );
- return lReturn;
- default:
- break;
- }
- return CallWindowProc( m_cWndProc, hWnd, message, wParam, lParam );
- }
-
- void CGroupBoxExt::OnPaint( HWND hWnd )
- {
- RECT Rect;
- char szTemp[256];
- HANDLE hHandle,hBrush;
- DWORD dwStyle;
- //取设置句柄
- MEMDCXP Mdcxp;
- HDC hDC ;
- // 获取内存兼容设备场景
- Mdcxp.hWnd = hWnd;
- Mdcxp.bTransfer = FALSE;
- Mdcxp.hBitmap = NULL;
- g_bDrawBk=1;
- GetMemDCXP(&Mdcxp);
- hDC = Mdcxp.hMemDC;
- // 获取窗口大小
- GetWindowRect(hWnd, &Rect);
- Rect.right -= Rect.left;
- Rect.bottom -= Rect.top;
- Rect.left = Rect.top = 0;
-
-
- // DeleteObject(hHandle);
- // ::SetBkColor (hDC, g_crDialogbkColor );
- // 画最外面的框,颜色与系统按钮颜色一直
- hBrush = SelectObject(hDC, GetStockObject(NULL_BRUSH));
- hHandle=SelectObject(hDC, g_frameedgepen);
- RoundRect(hDC, Rect.left,Rect.top+6,Rect.right,Rect.bottom,6,6);
- SelectObject(hDC, hBrush);
- SelectObject(hDC, hHandle);
- // 写文字
- dwStyle = (DWORD)GetWindowLong(hWnd, GWL_STYLE);
- if (GetWindowText(hWnd, szTemp, sizeof(szTemp)))
- {
- SetTextColor(hDC,
- ((g_wndstatelist.ElementAt (pos) & CXPS_INDETERMINATE) || (g_wndstatelist.ElementAt (pos) & CXPS_DISABLED)) ?
- 0x0094A2A5: 0x00000000);
- hHandle = (HANDLE) SelectObject(hDC,
- (HGDIOBJ) SendMessage(hWnd, WM_GETFONT, 0, 0));
- Rect.left+=5;
- DrawText(hDC, szTemp, -1, &Rect, DT_LEFT);
- SelectObject(hDC, (HGDIOBJ) hHandle);
- }
- Mdcxp.bTransfer = TRUE;
- ReleaseMemDCXP(&Mdcxp);
- }
|