Files
envi-code/SourceCode/Code2026/tg_shs/shs_kerncmd/BalconyDlg.cpp
T
2026-09-28 15:28:50 +08:00

187 lines
4.7 KiB
C++

// Balcony.cpp : implementation file
//
#include "stdafx.h"
#include "BalconyDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBalconyDlg dialog
CString CBalconyDlg::m_RailWidth = _T("100");
CString CBalconyDlg::m_RailHeight = _T("1000");
CString CBalconyDlg::m_Elev = _T("-100.0");
CString CBalconyDlg::m_SlabThick = _T("100");
CString CBalconyDlg::m_GirderThick = _T("100");
BOOL CBalconyDlg::m_bhasGirder = FALSE;
CBalconyDlg::CBalconyDlg(CWnd* pParent /*=NULL*/)
: CToolTipDialog(CBalconyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBalconyDlg)
//}}AFX_DATA_INIT
}
void CBalconyDlg::DoDataExchange(CDataExchange* pDX)
{
CToolTipDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBalconyDlg)
DDX_Text(pDX, IDC_RAILWIDTH, m_RailWidth);
DDX_Text(pDX, IDC_RAILHEIGHT, m_RailHeight);
DDX_Text(pDX, IDC_ELEV, m_Elev);
DDX_Text(pDX, IDC_SLABTHICK, m_SlabThick);
DDX_Text(pDX, IDC_GIRDERTHICK, m_GirderThick);
DDX_Check(pDX, IDC_CHECK_GIRDER, m_bhasGirder);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBalconyDlg, CToolTipDialog)
//{{AFX_MSG_MAP(CBalconyDlg)
ON_BN_CLICKED(IDC_CHECK_GIRDER, OnCheckGirder)
ON_WM_PAINT()
ON_EN_SETFOCUS(IDC_RAILWIDTH, OnSetfocusRailwidth)
ON_EN_SETFOCUS(IDC_RAILHEIGHT, OnSetfocusRailheight)
ON_EN_SETFOCUS(IDC_SLABTHICK, OnSetfocusSlabthick)
ON_EN_SETFOCUS(IDC_ELEV, OnSetfocusElev)
ON_EN_SETFOCUS(IDC_GIRDERTHICK, OnSetfocusGirderthick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBalconyDlg message handlers
void CBalconyDlg::OnCheckGirder()
{
m_bhasGirder = !m_bhasGirder;
CWnd *pWnd =GetDlgItem(IDC_GIRDERTHICK);
if (m_bhasGirder)
pWnd->EnableWindow(true);
else
pWnd->EnableWindow(false);
OpenSlide(_T("TArch(BalGirder)"));
}
void CBalconyDlg::OnOK()
{
double nGirderThick, nSlabThick;
UpdateData(true);
if (m_bhasGirder)
{
nGirderThick = _tstof(m_GirderThick);
nSlabThick = _tstof(m_SlabThick);
if (nGirderThick < nSlabThick)
{
AfxMessageBox(_T("梁高不能小于阳台地板厚!请从新输入。"));
return;
}
}
CToolTipDialog::OnOK();
}
BOOL CBalconyDlg::OnInitDialog()
{
CToolTipDialog::OnInitDialog();
AddTip(IDC_RAILWIDTH_TEXT);
AddTip(IDC_RAILHEIGHT_TEXT);
// ZJQ Add here
CWnd *pWnd =GetDlgItem(IDC_GIRDERTHICK);
pWnd->EnableWindow(m_bhasGirder);
// TODO: Add extra initialization here
//if (!FindFile(_T("BalconyWidth.sld"), m_strFilePath))
// AfxMessageBox(_T("无法找到幻灯片文件:BalconyWidth.sld"));
//else
OpenSlide(_T("TArch(BalWidth)"));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CBalconyDlg::OpenSlide(XString strFilePath)
{
CWnd *pImageBox=GetDlgItem(IDC_SLIDE);
if (pImageBox) {
CDC *pDC=pImageBox->GetDC();
CRect rc;
pImageBox->GetClientRect(&rc);
m_slideDc.InitDC(pDC, rc, GetAcadBackColor());
m_slideDc.PaintSlide(strFilePath);
m_slideDc.SetDC(NULL);
pImageBox->ReleaseDC(pDC);
}
}
void CBalconyDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rcClip, rcImage;
dc.GetClipBox(&rcClip);
CWnd *pImageBox=GetDlgItem(IDC_SLIDE);
if (pImageBox) {
pImageBox->GetWindowRect(&rcImage);
ScreenToClient(&rcImage);
if (!rcImage.IntersectRect(&rcImage, &rcClip))
return;
CDC *pDC=pImageBox->GetDC();
m_slideDc.SetDC(pDC);
m_slideDc.Redraw();
m_slideDc.SetDC(NULL);
pImageBox->ReleaseDC(pDC);
}
// Do not call CDialog::OnPaint() for painting messages
}
void CBalconyDlg::OnSetfocusRailwidth()
{
//if (!FindFile(_T("BalconyWidth.sld"), m_strFilePath))
// AfxMessageBox(_T("无法找到幻灯片文件:BalconyWidth.sld"));
//else
OpenSlide(_T("TArch(BalWidth)"));
}
void CBalconyDlg::OnSetfocusRailheight()
{
//if (!FindFile(_T("BalconyHeight.sld"), m_strFilePath))
// AfxMessageBox(_T("无法找到幻灯片文件:BalconyHeight.sld"));
//else
OpenSlide(_T("TArch(BalHeight)"));
}
void CBalconyDlg::OnSetfocusSlabthick()
{
//if (!FindFile(_T("BalconySlab.sld"), m_strFilePath))
// AfxMessageBox(_T("无法找到幻灯片文件:BalconySlab.sld"));
//else
OpenSlide(_T("TArch(BalSlab)"));
}
void CBalconyDlg::OnSetfocusElev()
{
//if (!FindFile(_T("BalconyElev.sld"), m_strFilePath))
// AfxMessageBox(_T("无法找到幻灯片文件:BalconySlab.Elev"));
//else
OpenSlide(_T("TArch(BalElev)"));
}
void CBalconyDlg::OnSetfocusGirderthick()
{
//if (!FindFile(_T("BalconyGirder.sld"), m_strFilePath))
// AfxMessageBox(_T("无法找到幻灯片文件:BalconyGirder.Elev"));
//else
OpenSlide(_T("TArch(BalGirder)"));
}