#include "stdafx.h" #include "ReducerDlg.h" IMPLEMENT_DYNAMIC(CReducerDlg, CDialog) CReducerDlg::CReducerDlg(CWnd* pParent /*=NULL*/) : CDialog(CReducerDlg::IDD, pParent) , m_nEcCen(0) , m_dW(6000) , m_sEndW(_T("4500")) , m_dL(4000) { } CReducerDlg::~CReducerDlg() { } void CReducerDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Radio(pDX, IDC_RADIO1, m_nEcCen); DDX_Text(pDX, IDC_EDIT5, m_dW); DDX_CBString(pDX, IDC_COMBO2, m_sEndW); DDX_Text(pDX, IDC_EDIT6, m_dL); } BEGIN_MESSAGE_MAP(CReducerDlg, CDialog) ON_BN_CLICKED(IDOK, &CReducerDlg::OnBnClickedOk) END_MESSAGE_MAP() BOOL CReducerDlg::OnInitDialog() { CDialog::OnInitDialog(); UpdateData(FALSE); return TRUE; } void CReducerDlg::OnBnClickedOk() { UpdateData(); if ( fabs(_ttof(m_sEndW) - m_dW) < 1.e-2) { AfxMessageBox(_T("变径首尾宽度不能相同!请重新选择宽度!")); return; } if (m_dL < 10.0 ) { AfxMessageBox(_T("变径长度过小!请重新输入长度!")); return; } OnOK(); } void CReducerDlg::SetCurWidth(double dW,double dL) { m_dW = dW; m_dL = dL; } int CReducerDlg::GetReducer(AcGePoint3d& ptSize) const { ptSize.x = m_dW; ptSize.y = _ttof(m_sEndW); ptSize.z = m_dL; return m_nEcCen; }