// RowDividerPage.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "DividerPage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern const TCHAR *g_szLineWidths[]; extern int g_nLineWidthNum; //extern XString GetSymbolName(AcDbObjectId idSymbolRec); ///////////////////////////////////////////////////////////////////////////// // CDividerPage property page IMPLEMENT_DYNCREATE(CDividerPage, CPropertyPage) CDividerPage::CDividerPage(UINT id) : CPropertyPage(id) { //{{AFX_DATA_INIT(CDividerPage) m_bNoDivider = FALSE; m_divLineWidth = _T(""); m_nLTItem=-1; //}}AFX_DATA_INIT m_nLineColor=0; for(int i=0; i &lstString) { combox.ResetContent(); for (int i = 0 ; i < lstString.Length(); i++) { combox.AddString(lstString[i]); } } void CDividerPage::Obj2Dlg(const TDividerStyle &style) { // 是否包含边框 m_bNoDivider=(style.GetDividerFlag()==TDividerStyle::kNone); // 线宽 m_divLineWidth.Format(_T("%.2f"), style.GetLineWidth()); for(int i=0; i-1.0E-3) style.SetLineWidth(_tstof(m_divLineWidth)); style.SetColor(m_nLineColor); // LINETYPE if(m_nLTItem>=0) { style.SetLineTypeId(GetLinetypeIdFromString(m_lstLinetypes[m_nLTItem])); } } void CDividerPage::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDividerPage) DDX_Control(pDX, IDC_DIVIDER_LINEWIDTH, m_lineWidthBox); DDX_Control(pDX, IDC_DIVIDER_LINETYPE, m_divLinetypeBox); DDX_Control(pDX, IDC_DIVIDER_COLOR, m_divColorBox); DDX_Check(pDX, IDC_NODIVIDER, m_bNoDivider); DDX_CBIndex(pDX, IDC_DIVIDER_LINETYPE, m_nLTItem); DDX_CBString(pDX, IDC_DIVIDER_LINEWIDTH, m_divLineWidth); //}}AFX_DATA_MAP if(pDX->m_bSaveAndValidate) { // Check value // ... int nIndex=m_divColorBox.GetCurrentItemColorIndex(); if(nIndex>=0) m_nLineColor=nIndex; if(_tstof(m_divLineWidth)<-1.0E-3) pDX->Fail(); } else { if(m_bNoDivider) { GetDlgItem(IDC_DIVIDER_COLOR)->EnableWindow(FALSE); GetDlgItem(IDC_DIVIDER_LINETYPE)->EnableWindow(FALSE); GetDlgItem(IDC_DIVIDER_LINEWIDTH)->EnableWindow(FALSE); } else { GetDlgItem(IDC_DIVIDER_COLOR)->EnableWindow(TRUE); GetDlgItem(IDC_DIVIDER_LINETYPE)->EnableWindow(TRUE); GetDlgItem(IDC_DIVIDER_LINEWIDTH)->EnableWindow(TRUE); } } } BEGIN_MESSAGE_MAP(CDividerPage, CPropertyPage) //{{AFX_MSG_MAP(CDividerPage) ON_BN_CLICKED(IDC_NODIVIDER, OnNoDivider) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDividerPage message handlers BOOL CDividerPage::OnInitDialog() { CPropertyPage::OnInitDialog(); // TODO: Add extra initialization here int nItem=m_divColorBox.FindItemByColorIndex(m_nLineColor); if(nItem<0) { m_divColorBox.AddColorToMRU(m_nLineColor); nItem=m_divColorBox.FindItemByColorIndex(m_nLineColor); } if(nItem>=0) m_divColorBox.SetCurSel(nItem); InitComBox(m_lineWidthBox, m_lstLineWidths); InitComBox(m_divLinetypeBox, m_lstLinetypes); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDividerPage::OnNoDivider() { UpdateData(TRUE); UpdateData(FALSE); }