Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

97 lines
1.9 KiB
C++

#include "stdafx.h"
#include "CylinderDlg.h"
#include "EarThwormDef.h"
IMPLEMENT_DYNAMIC(CCylinderDlg, CDialog)
CCylinderDlg::CCylinderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCylinderDlg::IDD, pParent)
, m_dR(100)
, m_dH(300)
, m_pData(NULL)
, m_clr(256)
, m_bSub(FALSE)
{
GET_CACHE(CCylinderDlg, %f%f%d, &m_dR, &m_dH, &m_clr);
}
CCylinderDlg::~CCylinderDlg()
{
}
void CCylinderDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDITR, m_dR);
DDX_Text(pDX, IDC_EDITH, m_dH);
DDX_Check(pDX, IDC_CHECK_SUB, m_bSub);
}
BEGIN_MESSAGE_MAP(CCylinderDlg, CDialog)
ON_BN_CLICKED(IDOK, &CCylinderDlg::OnBnClickedOk)
ON_BN_CLICKED(IDC_STATIC_COLOR, OnStaticColor)
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
BOOL CCylinderDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if (m_pData != NULL)
{
AecEqui::XCylinder* pCyln = (AecEqui::XCylinder*)m_pData;
m_dR = pCyln->dr;
m_dH = pCyln->dH;
UpdateData(FALSE);
}
return TRUE;
}
void CCylinderDlg::OnBnClickedOk()
{
UpdateData();
if (m_dR < 1.e-3 || m_dH < 1.e-3)
{
AfxMessageBox(_T("圆柱的半径和高度尺寸不能为0!请重新输入数据!"));
return;
}
if (m_pData != NULL)
{
AecEqui::XCylinder* pCyln = (AecEqui::XCylinder*)m_pData;
pCyln->dr = m_dR;
pCyln->dH = m_dH;
}
SET_CACHE(CCylinderDlg, %f%f%d, m_dR, m_dH, m_clr);
OnOK();
}
void CCylinderDlg::OnStaticColor()
{
AcCmColor clr;
#if ARX < 24
clr.setColorMethod(AcCmEntityColor::kByACI);
#endif
if (acedSetColorDialogTrueColor(clr, Adesk::kTrue, clr, (AcCm::DialogTabs)(AcCm::kACITab)) == Adesk::kFalse) return;
m_clr = clr.colorIndex();
Invalidate();
}
HBRUSH CCylinderDlg::OnCtlColor(CDC * pDC, CWnd * pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (nCtlColor == CTLCOLOR_STATIC)
{
if (pWnd != NULL && pWnd->GetDlgCtrlID() == IDC_STATIC_COLOR)
{
CRect rc;
pWnd->GetClientRect(rc);
pDC->FillSolidRect(rc, acedGetRGB(m_clr));
}
}
return hbr;
}