C++课程设计报告模板 下载本文

青岛理工大学毕业论文(设计)

BEGIN_MESSAGE_MAP(CMobile_listDlg, CDialog) //{{AFX_MSG_MAP(CMobile_listDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT()

ON_WM_QUERYDRAGICON()

ON_BN_CLICKED(IDC_BUTTONadd, OnBUTTONadd) ON_BN_CLICKED(IDC_BUTTONmodify, OnBUTTONmodify) ON_BN_CLICKED(IDC_BUTTONdelete, OnBUTTONdelete) ON_BN_CLICKED(IDC_BUTTONsort, OnBUTTONsort) ON_BN_CLICKED(IDC_BUTTONsearch, OnBUTTONsearch) ON_BN_CLICKED(IDC_BUTTONsave, OnBUTTONsave) ON_BN_CLICKED(IDC_BUTTONdisplay, OnBUTTONdisplay) ON_COMMAND(IDM_ABOUT, OnAbout)

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

///////////////////////////////////////////////////////////////////////////// // CMobile_listDlg message handlers

BOOL CMobile_listDlg::OnInitDialog() { CDialog::OnInitDialog();

// Add \

m_list.InsertColumn(0,\姓名\

m_list.InsertColumn(1,\手机号\21

//添加“姓名”列//添加“电话”列

青岛理工大学毕业论文(设计)

m_list.InsertColumn(2,\办公电话\

//

“phone”列

CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) {

CString strAboutMenu;

strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) {

pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING,

IDM_ABOUTBOX,

// IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000);

strAboutMenu);

}

}

// Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE);

// Set big icon

SetIcon(m_hIcon, FALSE);

// Set small icon

// TODO: Add extra initialization here

return TRUE; // return TRUE unless you set the focus to a control

22

青岛理工大学毕业论文(设计)

}

void CMobile_listDlg::OnSysCommand(UINT nID, LPARAM lParam) { }

// If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework.

void CMobile_listDlg::OnPaint() {

23

if ((nID & 0xFFF0) == IDM_ABOUTBOX) { } else { }

CDialog::OnSysCommand(nID, lParam); CAboutDlg dlgAbout; dlgAbout.DoModal();

if (IsIconic()) {

CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

青岛理工大学毕业论文(设计)

}

// The system calls this to obtain the cursor to display while the user drags // the minimized window.

HCURSOR CMobile_listDlg::OnQueryDragIcon() { }

void CMobile_listDlg::OnBUTTONadd() {

// Center icon in client rectangle

int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect;

GetClientRect(&rect);

int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2;

} else { }

// Draw the icon

dc.DrawIcon(x, y, m_hIcon);

CDialog::OnPaint();

return (HCURSOR) m_hIcon;

// TODO: Add your control notification handler code here

24