08 35 MFC CWnd CView CDialog CMy Dialog

  • Slides: 15
Download presentation
08: 35 MFC编程 CWnd CView CDialog CMy. Dialog CDocument CFile. Dialog 用户 意见 CStatic

08: 35 MFC编程 CWnd CView CDialog CMy. Dialog CDocument CFile. Dialog 用户 意见 CStatic CEdit CColor. Dialog CRadio CFont. Dialog CButton 化学软件开发

08: 35 对话窗 “不能对话的”About // 对话框 IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 STYLE DS_SETFONT

08: 35 对话窗 “不能对话的”About // 对话框 IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "关于 SDIC-02" FONT 9, "MS Shell Dlg" BEGIN ICON IDR_MAINFRAME, IDC_STATIC, 14, 21, 20 LTEXT "SDIC-02,1. 0 版", IDC_STATIC, 42, 14, 114, 8, SS_NOPREFIX LTEXT "Copyright (C) 2011", IDC_STATIC, 42, 26, 114, 8 DEFPUSHBUTTON "确定", IDOK, 113, 41, 50, 14, WS_GROUP END 化学软件开发

08: 35 MFC编程 对话窗 “能对话的” CMy. Dlg 控件 IDD_MYDLG DIALOGEX 0, 0, 224, 183

08: 35 MFC编程 对话窗 “能对话的” CMy. Dlg 控件 IDD_MYDLG DIALOGEX 0, 0, 224, 183 Control STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CStatic CAPTION "My. Dialog" FONT 8, "MS Shell Dlg", 400, 0, 0 x 1 BEGIN CEdit DEFPUSHBUTTON "确定", IDOK, 113, 162, 50, 14 PUSHBUTTON "取消", IDCANCEL, 167, 162, 50, 14 CRadio LTEXT "静态", IDC_STATIC, 29, 31, 67, 8 EDITTEXT IDC_EDIT 1, 118, 28, 89, 16, ES_AUTOHSCROLL CButton CONTROL "Radio 1", IDC_RADIO 1, "Button", BS_AUTORADIOBUTTON, 33, 63, 98, 16 CONTROL "Radio 2", IDC_RADIO 2, "Button", BS_AUTORADIOBUTTON, 33, 81, 104, 16 PUSHBUTTON "Button 1", IDC_BUTTON 1, 34, 110, 57, 21 END 资源模板 化学软件开发

08: 35 // CMy. Dialog 对话框 class CMy. Dialog : public CDialog { DECLARE_DYNAMIC(CMy.

08: 35 // CMy. Dialog 对话框 class CMy. Dialog : public CDialog { DECLARE_DYNAMIC(CMy. Dialog) public: CMy. Dialog(CWnd* p. Parent = NULL); // 标准构造函数 virtual ~CMy. Dialog(); // 对话框数据 IMPLEMENT_DYNAMIC(CMy. Dialog, CDialog) enum { IDD = IDD_MYDLG }; p. Parent /*=NULL*/) CMy. Dialog: : CMy. Dialog(CWnd* protected: : CDialog(CMy. Dialog: : IDD, p. Parent) { virtual void Do. Data. Exchange(CData. Exchange* p. DX); // DDX/DDV 支持 } DECLARE_MESSAGE_MAP() }; CMy. Dialog: : ~CMy. Dialog() { } void CMy. Dialog: : Do. Data. Exchange(CData. Exchange* p. DX) { CDialog: : Do. Data. Exchange(p. DX); } BEGIN_MESSAGE_MAP(CMy. Dialog, CDialog) END_MESSAGE_MAP() 化学软件开发

08: 35 菜单 CView CMy. Dialog 用户 意见 CDocument 化学软件开发

08: 35 菜单 CView CMy. Dialog 用户 意见 CDocument 化学软件开发

08: 35 菜单 资源 CDocument CView 化学软件开发

08: 35 菜单 资源 CDocument CView 化学软件开发

菜单 Document/View 08: 35 CView CDocument 化学软件开发

菜单 Document/View 08: 35 CView CDocument 化学软件开发

08: 35 菜单 Document/View class CSDIC 06 Doc : public CDocument { protected: //

08: 35 菜单 Document/View class CSDIC 06 Doc : public CDocument { protected: // 仅从序列化创建 CSDIC 06 Doc(); DECLARE_DYNCREATE(CSDIC 06 Doc)// 生成的消息映射函数 #include "SDIC 06 Doc. h" …… #include "My. Dialog. h“ protected: DECLARE_MESSAGE_MAP() IMPLEMENT_DYNCREATE(CSDIC 06 Doc, CDocument) public: afx_msg void On. View. Mydlg(); BEGIN_MESSAGE_MAP(CSDIC 06 Doc, CDocument) }; ON_COMMAND(ID_VIEW_MYDLG, &CSDIC 06 Doc: : On. View. Mydlg) END_MESSAGE_MAP() void CSDIC 06 Doc: : On. View. Mydlg() { // TODO: 在此添加命令处理程序代码 CMy. Dialog mydlg; mydlg. Do. Modal(); } 化学软件开发