EastDraw.cpp
上传用户:qiye66671
上传日期:2009-12-10
资源大小:182k
文件大小:6k
源码类别:

绘图程序

开发平台:

C/C++

  1. // EastDraw.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "EastDraw.h"
  5. #include "MainFrm.h"
  6. #include "ChildFrm.h"
  7. #include "EastDrawDoc.h"
  8. #include "EastDrawView.h"
  9. #include "Splash.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CEastDrawApp
  17. BEGIN_MESSAGE_MAP(CEastDrawApp, CWinApp)
  18. //{{AFX_MSG_MAP(CEastDrawApp)
  19. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  20. // NOTE - the ClassWizard will add and remove mapping macros here.
  21. //    DO NOT EDIT what you see in these blocks of generated code!
  22. //}}AFX_MSG_MAP
  23. // Standard file based document commands
  24. ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  25. ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  26. // Standard print setup command
  27. ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  28. END_MESSAGE_MAP()
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CEastDrawApp construction
  31. CEastDrawApp::CEastDrawApp()
  32. {
  33. // TODO: add construction code here,
  34. // Place all significant initialization in InitInstance
  35. }
  36. /////////////////////////////////////////////////////////////////////////////
  37. // The one and only CEastDrawApp object
  38. CEastDrawApp theApp;
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CEastDrawApp initialization
  41. BOOL CEastDrawApp::InitInstance()
  42. {
  43. // CG: The following block was added by the Splash Screen component. { CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash); }
  44. AfxEnableControlContainer();
  45. // Standard initialization
  46. // If you are not using these features and wish to reduce the size
  47. //  of your final executable, you should remove from the following
  48. //  the specific initialization routines you do not need.
  49. #ifdef _AFXDLL
  50. Enable3dControls(); // Call this when using MFC in a shared DLL
  51. #else
  52. Enable3dControlsStatic(); // Call this when linking to MFC statically
  53. #endif
  54. // Change the registry key under which our settings are stored.
  55. // TODO: You should modify this string to be something appropriate
  56. // such as the name of your company or organization.
  57. SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  58. LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  59. // Register the application's document templates.  Document templates
  60. //  serve as the connection between documents, frame windows and views.
  61. CMultiDocTemplate* pDocTemplate;
  62. pDocTemplate = new CMultiDocTemplate(
  63. IDR_EASTDRTYPE,
  64. RUNTIME_CLASS(CEastDrawDoc),
  65. RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  66. RUNTIME_CLASS(CEastDrawView));
  67. AddDocTemplate(pDocTemplate);
  68. // create main MDI Frame window
  69. CMainFrame* pMainFrame = new CMainFrame;
  70. if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  71. return FALSE;
  72. m_pMainWnd = pMainFrame;
  73. // Enable drag/drop open
  74. m_pMainWnd->DragAcceptFiles();
  75. // Enable DDE Execute open
  76. EnableShellOpen();
  77. RegisterShellFileTypes(TRUE);
  78. // Parse command line for standard shell commands, DDE, file open
  79. CCommandLineInfo cmdInfo;
  80. ParseCommandLine(cmdInfo);
  81. // Dispatch commands specified on the command line
  82. if (!ProcessShellCommand(cmdInfo))
  83. return FALSE;
  84. // The main window has been initialized, so show and update it.
  85. pMainFrame->ShowWindow(m_nCmdShow);
  86. pMainFrame->UpdateWindow();
  87. return TRUE;
  88. }
  89. /////////////////////////////////////////////////////////////////////////////
  90. // CAboutDlg dialog used for App About
  91. class CAboutDlg : public CDialog
  92. {
  93. public:
  94. CAboutDlg();
  95. // Dialog Data
  96. //{{AFX_DATA(CAboutDlg)
  97. enum { IDD = IDD_ABOUTBOX };
  98. //}}AFX_DATA
  99. // ClassWizard generated virtual function overrides
  100. //{{AFX_VIRTUAL(CAboutDlg)
  101. protected:
  102. virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  103. //}}AFX_VIRTUAL
  104. // Implementation
  105. protected:
  106. //{{AFX_MSG(CAboutDlg)
  107. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  108. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  109. //}}AFX_MSG
  110. DECLARE_MESSAGE_MAP()
  111. };
  112. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  113. {
  114. //{{AFX_DATA_INIT(CAboutDlg)
  115. //}}AFX_DATA_INIT
  116. }
  117. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  118. {
  119. CDialog::DoDataExchange(pDX);
  120. //{{AFX_DATA_MAP(CAboutDlg)
  121. //}}AFX_DATA_MAP
  122. }
  123. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  124. //{{AFX_MSG_MAP(CAboutDlg)
  125. ON_WM_CTLCOLOR()
  126. ON_WM_LBUTTONDOWN()
  127. //}}AFX_MSG_MAP
  128. END_MESSAGE_MAP()
  129. // App command to run the dialog
  130. void CEastDrawApp::OnAppAbout()
  131. {
  132. CAboutDlg aboutDlg;
  133. aboutDlg.DoModal();
  134. }
  135. /////////////////////////////////////////////////////////////////////////////
  136. // CEastDrawApp message handlers
  137. HBRUSH CAboutDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
  138. {
  139. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  140. // TODO: Change any attributes of the DC here
  141.    pDC->SetTextColor(RGB(0,100,255));
  142.    pDC->SetBkColor(RGB(100,200,200));
  143.    //pDC->SelectObject(&brush);
  144.    pDC->SetBkMode(TRANSPARENT);
  145. // TODO: Return a different brush if the default is not desired
  146. return hbr;
  147. }
  148. BOOL CEastDrawApp::PreTranslateMessage(MSG* pMsg)
  149. {
  150. // CG: The following lines were added by the Splash Screen component. if (CSplashWnd::PreTranslateAppMessage(pMsg)) return TRUE; return CWinApp::PreTranslateMessage(pMsg);
  151. }
  152. void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point) 
  153. {
  154. // TODO: Add your message handler code here and/or call default
  155.      OnOK();
  156. //CDialog::OnLButtonDown(nFlags, point);
  157. }