⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 polygonalldlg.cpp

📁 这是书上的代码
💻 CPP
字号:
// PolygonallDlg.cpp : implementation file
//

#include "stdafx.h"
#include "const.h"
#include "paintobj.h"
#include "painted.h"
#include "paintdoc.h"
#include "PolygonallDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPolygonallDlg dialog


CPolygonallDlg::CPolygonallDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPolygonallDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPolygonallDlg)
	m_nCount = 0;
	m_nID = 0;
	m_dX = 0.0;
	m_dY = 0.0;
	//}}AFX_DATA_INIT
}


void CPolygonallDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPolygonallDlg)
	DDX_Control(pDX, IDC_SPIN1, m_ctlSpin);
	DDX_Text(pDX, IDC_COUNT, m_nCount);
	DDX_Text(pDX, IDC_ID, m_nID);
	DDX_Text(pDX, IDC_X, m_dX);
	DDX_Text(pDX, IDC_Y, m_dY);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPolygonallDlg, CDialog)
	//{{AFX_MSG_MAP(CPolygonallDlg)
	ON_EN_CHANGE(IDC_COUNT, OnChangeCount)
	ON_EN_CHANGE(IDC_ID, OnChangeId)
	ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
	ON_EN_CHANGE(IDC_X, OnChangeX)
	ON_EN_CHANGE(IDC_Y, OnChangeY)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPolygonallDlg message handlers

BOOL CPolygonallDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	CWnd* pWnd = GetDlgItem(IDC_ID);
	m_ctlSpin.SetBuddy(pWnd);
	m_ctlSpin.SetRange(0,1);	
	m_ctlSpin.SetPos(0);
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPolygonallDlg::OnChangeCount() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);	
	m_ctlSpin.SetRange(0,m_nCount-1);	
	m_ctlSpin.SetPos(0);
}

void CPolygonallDlg::OnChangeId() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);	
	m_pDoc->m_nCountId=m_nID;
	m_dX=m_pDoc->PointXY[m_nID].x;
	m_dY=m_pDoc->PointXY[m_nID].y;
	UpdateData(FALSE);

}

void CPolygonallDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here
//	UpdateData(TRUE);
//	m_pDoc->PointXY[m_pDoc->m_nCountId].x=m_dX;
//	m_pDoc->PointXY[m_pDoc->m_nCountId].y=m_dY;
	*pResult = 0;
}

void CPolygonallDlg::OnChangeX() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	UpdateData(TRUE);
	m_pDoc->PointXY[m_pDoc->m_nCountId].x=m_dX;
	// TODO: Add your control notification handler code here
	
}

void CPolygonallDlg::OnChangeY() 
{
	// TODO: If this is a RICHEDIT control, the control will not
	// send this notification unless you override the CDialog::OnInitDialog()
	// function and call CRichEditCtrl().SetEventMask()
	// with the ENM_CHANGE flag ORed into the mask.
	UpdateData(TRUE);
	m_pDoc->PointXY[m_pDoc->m_nCountId].y=m_dY;
	// TODO: Add your control notification handler code here
	
}








⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -