Test_HMXControls.cpp
上传用户:yinguanfa
上传日期:2022-02-19
资源大小:400k
文件大小:6k
源码类别:

ListView/ListBox

开发平台:

Visual C++

  1. // Test_HMXControls.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "Test_HMXControls.h"
  5. #include "MainFrm.h"
  6. #include "ChildFrm.h"
  7. #include "Test_HMXControlsDoc.h"
  8. #include "Test_HMXControlsView.h"
  9. #include "HMXControlsHMXControls.h"
  10. #include "TestHMXdialog.h"
  11. #include "TestHMXShapedDialog.h"
  12. #include "TestHMXFormView.h"
  13. #include "TestHMXshapedFormView.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CTest_HMXControlsApp
  21. BEGIN_MESSAGE_MAP(CTest_HMXControlsApp, CWinApp)
  22. //{{AFX_MSG_MAP(CTest_HMXControlsApp)
  23. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24. ON_COMMAND(ID_FILE_HMXDIALOG, OnFileHMXDialog)
  25. ON_COMMAND(ID_FILE_HMXSHAPEDDIALOG, OnFileHMXShapedDialog)
  26. ON_COMMAND(ID_FILE_HMXFORMVIEW, OnFileHMXFormView)
  27. ON_COMMAND(ID_FILE_HMXSHAPEDFORMVIEW, OnFileHMXShapedFormView)
  28. //}}AFX_MSG_MAP
  29. // Standard file based document commands
  30. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  31. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  32. // Standard print setup command
  33. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  34. END_MESSAGE_MAP()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CTest_HMXControlsApp construction
  37. CTest_HMXControlsApp::CTest_HMXControlsApp()
  38. {
  39. // TODO: add construction code here,
  40. // Place all significant initialization in InitInstance
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // The one and only CTest_HMXControlsApp object
  44. CTest_HMXControlsApp theApp;
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CTest_HMXControlsApp initialization
  47. BOOL CTest_HMXControlsApp::InitInstance()
  48. {
  49. g_sPaperBMP = "paper.bmp";
  50. g_rgbPaperTransp = RGB( 255, 0, 0);
  51. // Standard initialization
  52. // If you are not using these features and wish to reduce the size
  53. //  of your final executable, you should remove from the following
  54. //  the specific initialization routines you do not need.
  55. #ifdef _AFXDLL
  56. Enable3dControls(); // Call this when using MFC in a shared DLL
  57. #else
  58. Enable3dControlsStatic(); // Call this when linking to MFC statically
  59. #endif
  60. // Change the registry key under which our settings are stored.
  61. // You should modify this string to be something appropriate
  62. // such as the name of your company or organization.
  63. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  64. LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  65. // Register the application's document templates.  Document templates
  66. //  serve as the connection between documents, frame windows and views.
  67. CMultiDocTemplate* pDocTemplate;
  68. // HMXFormView
  69. pDocTemplate = new CMultiDocTemplate(
  70. IDR_TEST_HTYPE,
  71. RUNTIME_CLASS(CTest_HMXControlsDoc),
  72. RUNTIME_CLASS(CChildFrame),
  73. RUNTIME_CLASS(CTestHMXFormView));
  74. AddDocTemplate(pDocTemplate);
  75. // HMXShapedFormView
  76. pDocTemplate = new CMultiDocTemplate(
  77. IDR_TEST_HTYPE,
  78. RUNTIME_CLASS(CTest_HMXControlsDoc),
  79. RUNTIME_CLASS(CHMXChildFrame),
  80. RUNTIME_CLASS(CTestHMXShapedFormView));
  81. AddDocTemplate(pDocTemplate);
  82. // create main MDI Frame window
  83. CMainFrame* pMainFrame = new CMainFrame;
  84. if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  85. return FALSE;
  86. m_pMainWnd = pMainFrame;
  87. // Parse command line for standard shell commands, DDE, file open
  88. CCommandLineInfo cmdInfo;
  89. ParseCommandLine(cmdInfo);
  90. // Dispatch commands specified on the command line
  91. // if (!ProcessShellCommand(cmdInfo))
  92. // return FALSE;
  93. // The main window has been initialized, so show and update it.
  94. pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
  95. pMainFrame->UpdateWindow();
  96. return TRUE;
  97. }
  98. /////////////////////////////////////////////////////////////////////////////
  99. // CAboutDlg dialog used for App About
  100. class CAboutDlg : public CDialog
  101. {
  102. public:
  103. CAboutDlg();
  104. // Dialog Data
  105. //{{AFX_DATA(CAboutDlg)
  106. enum { IDD = IDD_ABOUTBOX };
  107. //}}AFX_DATA
  108. // ClassWizard generated virtual function overrides
  109. //{{AFX_VIRTUAL(CAboutDlg)
  110. protected:
  111. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  112. //}}AFX_VIRTUAL
  113. // Implementation
  114. protected:
  115. //{{AFX_MSG(CAboutDlg)
  116. // No message handlers
  117. //}}AFX_MSG
  118. DECLARE_MESSAGE_MAP()
  119. };
  120. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  121. {
  122. //{{AFX_DATA_INIT(CAboutDlg)
  123. //}}AFX_DATA_INIT
  124. }
  125. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  126. {
  127. CDialog::DoDataExchange(pDX);
  128. //{{AFX_DATA_MAP(CAboutDlg)
  129. //}}AFX_DATA_MAP
  130. }
  131. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  132. //{{AFX_MSG_MAP(CAboutDlg)
  133. // No message handlers
  134. //}}AFX_MSG_MAP
  135. END_MESSAGE_MAP()
  136. // App command to run the dialog
  137. void CTest_HMXControlsApp::OnAppAbout()
  138. {
  139. CAboutDlg aboutDlg;
  140. aboutDlg.DoModal();
  141. }
  142. /////////////////////////////////////////////////////////////////////////////
  143. // CTest_HMXControlsApp commands
  144. void CTest_HMXControlsApp::OnFileHMXDialog() 
  145. {
  146. // TODO: Add your command handler code here
  147. CTestHMXDialog dlg;
  148. dlg.DoModal();
  149. }
  150. void CTest_HMXControlsApp::OnFileHMXShapedDialog() 
  151. {
  152. // TODO: Add your command handler code here
  153. CTestHMXShapedDialog dlg;
  154. // set the bitmap background image/shape and transparent color (depends on image)
  155. dlg.SetRegionFile( "Metallic.bmp", RGB( 255, 255, 0 ) );
  156. dlg.DoModal();
  157. }
  158. void CTest_HMXControlsApp::OnFileHMXFormView() 
  159. {
  160. // TODO: Add your command handler code here
  161. POSITION pos;
  162. CDocTemplate *pDoc;
  163. pos = GetFirstDocTemplatePosition();
  164. pDoc = GetNextDocTemplate( pos );
  165. pDoc->OpenDocumentFile( NULL );
  166. }
  167. void CTest_HMXControlsApp::OnFileHMXShapedFormView() 
  168. {
  169. // TODO: Add your command handler code here
  170. POSITION pos;
  171. CDocTemplate *pDoc;
  172. pos = GetFirstDocTemplatePosition();
  173. pDoc = GetNextDocTemplate( pos );
  174. pDoc = GetNextDocTemplate( pos );
  175. pDoc->OpenDocumentFile( NULL );
  176. }