ProfUIS_Controls.h
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:5k
源码类别:

界面编程

开发平台:

Visual C++

  1. // ProfUIS_Controls.h : main header file for the PROFUIS_CONTROLS application
  2. //
  3. #if !defined(AFX_PROFUIS_CONTROLS_H__4ABF6D1C_5BEA_4FEB_B891_B762A236AE89__INCLUDED_)
  4. #define AFX_PROFUIS_CONTROLS_H__4ABF6D1C_5BEA_4FEB_B891_B762A236AE89__INCLUDED_
  5. #if _MSC_VER > 1000
  6. #pragma once
  7. #endif // _MSC_VER > 1000
  8. #ifndef __AFXWIN_H__
  9. #error include 'stdafx.h' before including this file for PCH
  10. #endif
  11. #include "resource.h" // main symbols
  12. #define __CANCEL_BUTTON_PRESSED_EVENT_RESULT_DESCRIPTION _T("***Cancel***")
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMainApp:
  15. // See ProfUIS_Controls.cpp for the implementation of this class
  16. //
  17. class CMainApp : public CWinApp
  18. {
  19. public:
  20. IMPLEMENT_CWinAPP_DoMessageBox;
  21. CMainApp();
  22. // Overrides
  23. // ClassWizard generated virtual function overrides
  24. //{{AFX_VIRTUAL(CMainApp)
  25. public:
  26. virtual BOOL InitInstance();
  27. //}}AFX_VIRTUAL
  28. // Implementation
  29. //{{AFX_MSG(CMainApp)
  30. // NOTE - the ClassWizard will add and remove member functions here.
  31. //    DO NOT EDIT what you see in these blocks of generated code !
  32. //}}AFX_MSG
  33. DECLARE_MESSAGE_MAP()
  34. };
  35. //////////////////////////////////////////////////////////////////////////
  36. // CExtFlatEdit
  37. //////////////////////////////////////////////////////////////////////////
  38. class CExtFlatEdit : public CExtEditBase 
  39. {
  40. public:
  41.     CExtFlatEdit::CExtFlatEdit()
  42.         : CExtEditBase()
  43.     {
  44.     }
  45.     
  46. protected:
  47.     
  48.     virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
  49.     {
  50.         switch( message )
  51.         {
  52.         case WM_NCPAINT:
  53.             {
  54.                 DefWindowProc(
  55.                     WM_NCPAINT,
  56.                     wParam,
  57.                     lParam
  58.                     );
  59.                 CRect rcInBarWnd, rcInBarClient;
  60.                 GetWindowRect( &rcInBarWnd );
  61.                 GetClientRect( &rcInBarClient );
  62.                 ClientToScreen( &rcInBarClient );
  63.                 if( rcInBarWnd == rcInBarClient )
  64.                     return 0;
  65.                 CPoint ptDevOffset = -rcInBarWnd.TopLeft();
  66.                 rcInBarWnd.OffsetRect( ptDevOffset );
  67.                 rcInBarClient.OffsetRect( ptDevOffset );
  68.                 
  69.                 CWindowDC dc( this );
  70.                 ASSERT( dc.GetSafeHdc() != NULL );
  71.                 const int cx = ::GetSystemMetrics(SM_CXVSCROLL);
  72.                 const int cy = ::GetSystemMetrics(SM_CYHSCROLL);
  73.             
  74.                 bool bHasVerticalSB = 
  75.                     ( rcInBarWnd.Width() - rcInBarClient.Width() ) >= cx;
  76.                 bool bHasHorizontalSB = 
  77.                     ( rcInBarWnd.Height() - rcInBarClient.Height() ) >= cy;
  78.             
  79.                 if( bHasVerticalSB && bHasHorizontalSB )
  80.                 {
  81.                     dc.FillSolidRect(
  82.                         rcInBarWnd.right - cx - 4,
  83.                         rcInBarWnd.bottom - cy - 4,
  84.                         cx,
  85.                         cy,
  86.                         g_PaintManager->GetColor(COLOR_WINDOW)
  87.                         );
  88.                 }
  89.                 CRect rcExclude( rcInBarClient );
  90.                 if( bHasVerticalSB )
  91.                     rcExclude.right += cx;
  92.                 if( bHasHorizontalSB )
  93.                     rcExclude.bottom += cy;
  94.                 dc.ExcludeClipRect( &rcExclude );
  95.                 
  96.                 static const TCHAR szEditBox[] = _T("EDIT");
  97.                 TCHAR szCompare[sizeof(szEditBox)/sizeof(szEditBox[0])+1];
  98.                 ::GetClassName( 
  99.                     GetSafeHwnd(), 
  100.                     szCompare, 
  101.                     sizeof(szCompare)/sizeof(szCompare[0]) 
  102.                 );
  103.                 if( !lstrcmpi( szCompare, szEditBox ) )
  104. {
  105.                     bool bReadOnly = 
  106.                         ( (GetStyle() & ES_READONLY) != 0 ) ? true : false;
  107. COLORREF clrSysBk =
  108. g_PaintManager->GetColor( 
  109. bReadOnly 
  110. ? COLOR_3DFACE
  111. : COLOR_WINDOW 
  112. );
  113. dc.FillSolidRect(
  114. &rcInBarWnd, 
  115. clrSysBk
  116. );
  117.                 }
  118.                 
  119.                 g_PaintManager->PaintResizableBarChildNcAreaRect(
  120.                     dc,
  121.                     rcInBarWnd,
  122.                     this
  123.                     );
  124.     
  125.                 return 0;
  126.             } // case WM_NCPAINT
  127.         }; // switch( message )
  128.         return CExtEditBase::WindowProc( message, wParam, lParam );
  129.     };
  130. };
  131. /////////////////////////////////////////////////////////////////////////////
  132. //{{AFX_INSERT_LOCATION}}
  133. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  134. #endif // !defined(AFX_PROFUIS_CONTROLS_H__4ABF6D1C_5BEA_4FEB_B891_B762A236AE89__INCLUDED_)