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

界面编程

开发平台:

Visual C++

  1. // ChildView.cpp : implementation of the CChildView class
  2. //
  3. #include "stdafx.h"
  4. #include "HelpNotes.h"
  5. #include "ChildView.h"
  6. #include "resource.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. IMPLEMENT_DYNCREATE( CChildView, CFormView );
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CChildView
  15. CChildView::CChildView()
  16. : CExtWS < CExtWA < CExtAFV < CFormView > > > ( CChildView::IDD, (CWnd*) NULL )
  17. {
  18. }
  19. CChildView::~CChildView()
  20. {
  21. }
  22. void CChildView::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CFormView::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CChildView)
  26. DDX_Control(pDX, IDC_RADIO_SHADOW_1, m_radioShadow1);
  27. DDX_Control(pDX, IDC_RADIO_SHADOW_2, m_radioShadow2);
  28. DDX_Control(pDX, IDC_RADIO_SHADOW_3, m_radioShadow3);
  29. DDX_Control(pDX, IDC_CHECK_CUSTOM_BORDER_RB_COLOR, m_checkCustomBorderRbColor);
  30. DDX_Control(pDX, IDC_BUTTON_CUSTOM_BORDER_RB_COLOR, m_buttonCustomBorderRbColor);
  31. DDX_Control(pDX, IDC_CHECK_CUSTOM_BORDER_LT_COLOR, m_checkCustomBorderLtColor);
  32. DDX_Control(pDX, IDC_BUTTON_CUSTOM_BORDER_LT_COLOR, m_buttonCustomBorderLtColor);
  33. DDX_Control(pDX, IDC_CHECK_CUSTOM_BACKGROUND_COLOR, m_checkCustomBkColor);
  34. DDX_Control(pDX, IDC_BUTTON_CUSTOM_BACKGROUND_COLOR, m_buttonCustomBkColor);
  35. DDX_Control(pDX, IDC_STATIC_GROUP1, m_groupBox1);
  36. DDX_Control(pDX, IDC_STATIC_GROUP2, m_groupBox2);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(CChildView,CFormView)
  40. //{{AFX_MSG_MAP(CChildView)
  41. ON_COMMAND(ID_EDIT_UNDO, OnEditUndo)
  42. ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
  43. ON_COMMAND(ID_EDIT_CUT, OnEditCut)
  44. ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
  45. ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
  46. ON_WM_SIZE()
  47. ON_COMMAND(ID_FILE_NEW, OnFileNew)
  48. ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
  49. ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
  50. ON_COMMAND(ID_FILE_SAVE, OnFileSave)
  51. ON_COMMAND(ID_FILE_SEND_MAIL, OnFileSendMail)
  52. ON_BN_CLICKED(IDC_CHECK_CUSTOM_BACKGROUND_COLOR, OnCheckCustomBackgroundColor)
  53. ON_BN_CLICKED(IDC_CHECK_CUSTOM_BORDER_LT_COLOR, OnCheckCustomBorderLtColor)
  54. ON_BN_CLICKED(IDC_CHECK_CUSTOM_BORDER_RB_COLOR, OnCheckCustomBorderRbColor)
  55. //}}AFX_MSG_MAP
  56. END_MESSAGE_MAP()
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CChildView message handlers
  59. #ifndef IS_COMMAND_ID
  60. #define IS_COMMAND_ID( nID ) ( (nID) & 0x8000 )
  61. #endif
  62. BOOL CChildView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) 
  63. {
  64. if( CWnd::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) )
  65. return TRUE;
  66. if( ( nCode != CN_COMMAND && nCode != CN_UPDATE_COMMAND_UI )
  67. || (! IS_COMMAND_ID( nID ) )
  68. || nID >= 0xF000
  69. )
  70. return FALSE;
  71. CWinThread * pThread = ::AfxGetThread();
  72. if( pThread != NULL
  73. && pThread->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo )
  74. )
  75. return TRUE;
  76. return FALSE;
  77. }
  78. void CChildView::OnFileNew() 
  79. {
  80. ::AfxMessageBox( _T("CChildView::OnFileNew()") );
  81. }
  82. void CChildView::OnFileOpen() 
  83. {
  84. ::AfxMessageBox( _T("CChildView::OnFileOpen()") );
  85. }
  86. void CChildView::OnFileSave() 
  87. {
  88. ::AfxMessageBox( _T("CChildView::OnFileSave()") );
  89. }
  90. void CChildView::OnFileSendMail() 
  91. {
  92. ::AfxMessageBox( _T("CChildView::OnFileSendMail()") );
  93. }
  94. void CChildView::OnFilePrint() 
  95. {
  96. ::AfxMessageBox( _T("CChildView::OnFilePrint()") );
  97. }
  98. void CChildView::OnFilePrintPreview() 
  99. {
  100. ::AfxMessageBox( _T("CChildView::OnFilePrintPreview()") );
  101. }
  102. void CChildView::OnEditUndo() 
  103. {
  104. ::AfxMessageBox( _T("CChildView::OnEditUndo()") );
  105. }
  106. void CChildView::OnEditCopy() 
  107. {
  108. ::AfxMessageBox( _T("CChildView::OnEditCopy()") );
  109. }
  110. void CChildView::OnEditCut() 
  111. {
  112. ::AfxMessageBox( _T("CChildView::OnEditCut()") );
  113. }
  114. void CChildView::OnEditPaste() 
  115. {
  116. ::AfxMessageBox( _T("CChildView::OnEditPaste()") );
  117. }
  118. void CChildView::OnInitialUpdate() 
  119. {
  120. CFormView::OnInitialUpdate();
  121. ShowSizeGrip( FALSE );
  122. m_groupBox1.SetStyle( CExtGroupBox::STYLE_CAPTION );
  123. m_groupBox2.SetStyle( CExtGroupBox::STYLE_CAPTION );
  124. m_radioShadow2.SetCheck( 1 );
  125. m_buttonCustomBkColor.SetFlat( TRUE );
  126. m_buttonCustomBorderLtColor.SetFlat( TRUE );
  127. m_buttonCustomBorderRbColor.SetFlat( TRUE );
  128. m_buttonCustomBkColor.m_clrDefault
  129. = m_buttonCustomBkColor.m_clrSelected
  130. = RGB(224,248,255);
  131. m_buttonCustomBorderLtColor.m_clrDefault
  132. = m_buttonCustomBorderLtColor.m_clrSelected
  133. = m_buttonCustomBorderRbColor.m_clrDefault
  134. = m_buttonCustomBorderRbColor.m_clrSelected
  135. = RGB(0,0,0);
  136. m_buttonCustomBkColor.m_bEnableBtnColorDefault = false;
  137. m_buttonCustomBorderLtColor.m_bEnableBtnColorDefault = false;
  138. m_buttonCustomBorderRbColor.m_bEnableBtnColorDefault = false;
  139. }
  140. void CChildView::OnSize(UINT nType, int cx, int cy) 
  141. {
  142. CWnd::OnSize(nType, cx, cy);
  143. }
  144. void CChildView::OnCheckCustomBackgroundColor() 
  145. {
  146. m_buttonCustomBkColor.EnableWindow(
  147. ( m_checkCustomBkColor.GetCheck() != 0 )
  148. ? TRUE : FALSE
  149. );
  150. }
  151. void CChildView::OnCheckCustomBorderLtColor() 
  152. {
  153. m_buttonCustomBorderLtColor.EnableWindow(
  154. ( m_checkCustomBorderLtColor.GetCheck() != 0 )
  155. ? TRUE : FALSE
  156. );
  157. }
  158. void CChildView::OnCheckCustomBorderRbColor() 
  159. {
  160. m_buttonCustomBorderRbColor.EnableWindow(
  161. ( m_checkCustomBorderRbColor.GetCheck() != 0 )
  162. ? TRUE : FALSE
  163. );
  164. }