www.pudn.com > Paint_SockAPI.rar > SetPenDlg.cpp
// SetPenDlg.cpp : implementation of the CSetPenDlg class
//
#include "stdafx.h"
#include "Paint.h"
#include "SetPenDlg.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetPenDlg
CSetPenDlg::CSetPenDlg() : CDialog(CSetPenDlg::IDD)
{
// 这里自动调用了UpdateData(FALSE)将变量值传给控件
//{{AFX_DATA_INIT(CSetPenDlg)
m_PenWidth = 0;
//}}AFX_DATA_INIT
}
void CSetPenDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetPenDlg)
DDX_Text(pDX, IDC_EDIT1, m_PenWidth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetPenDlg, CDialog)
//{{AFX_MSG_MAP(CSetPenDlg)
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CSetPenDlg::OnOK()
{
// 设置画笔宽度,用UpdateData(TRUE)将控件的数据传给变量
UpdateData(TRUE);
CMainFrame *pFrame = (CMainFrame *)AfxGetApp()->GetMainWnd();
pFrame->m_wndView.m_PenWidth = m_PenWidth;
CDialog::OnOK();
}
void CSetPenDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
if (bShow)
{
CEdit* edit1 = (CEdit*)GetDlgItem(IDC_EDIT1);
edit1->SetFocus();
}
}