NPenDlg.cpp
资源名称:VC6.0.rar [点击查看]
上传用户:qdhmjx
上传日期:2022-07-11
资源大小:2226k
文件大小:2k
源码类别:
书籍源码
开发平台:
Visual C++
- // NPenDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ex71.h"
- #include "NPenDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CNPenDlg dialog
- CNPenDlg::CNPenDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CNPenDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CNPenDlg)
- m_nWidthEdit = 0;
- //}}AFX_DATA_INIT
- }
- CNPenDlg::CNPenDlg(CView* pParent)
- {
- pView=pParent;
- }
- void CNPenDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CNPenDlg)
- DDX_Control(pDX, IDC_SPIN, m_ctrlSpin);
- DDX_Control(pDX, IDC_Width, m_ctrlWidthEdit);
- DDX_Text(pDX, IDC_Width, m_nWidthEdit);
- DDV_MinMaxInt(pDX, m_nWidthEdit, 1, 10);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CNPenDlg, CDialog)
- //{{AFX_MSG_MAP(CNPenDlg)
- ON_BN_CLICKED(IDC_Apply, OnApply)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CNPenDlg message handlers
- BOOL CNPenDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_ctrlSpin.SetBuddy(&m_ctrlWidthEdit); //将编辑框设置为微调控件的伙伴窗口。
- m_ctrlSpin.SetRange(1,10);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CNPenDlg::OnApply()
- {
- UpdateData(TRUE); //调用UpdateData函数,数值从控件传给变量
- pView->PostMessage(WM_APPLY);
- }
- void CNPenDlg::OnOK()
- {
- UpdateData(TRUE);
- pView->PostMessage(WM_APPLY);
- CDialog::OnOK();
- }