// TestDlg.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "TestDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CTestDlg dialog CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/) : CModelessDialog(CTestDlg::IDD, pParent) { //{{AFX_DATA_INIT(CTestDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT DList lstMater; lstMater.Append(new TMaterialStruct(_T("粉刷"), _T("粉刷"), 7, 20)); lstMater.Append(new TMaterialStruct(_T("钢筋混凝土"), _T("钢筋混凝土"), 6, 200)); lstMater.Append(new TMaterialStruct(_T("多孔材料"), _T("多孔材料"), 9, 200)); m_preview.SetMaterials(lstMater); } void CTestDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTestDlg) DDX_Control(pDX, IDC_PREVIEW, m_preview); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CTestDlg, CModelessDialog) //{{AFX_MSG_MAP(CTestDlg) ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTestDlg message handlers BOOL CTestDlg::OnInitDialog() { CDialog::OnInitDialog(); //if (!m_preview.SubclassDlgItem(IDC_PREVIEW,this)) // return FALSE; m_preview.UpdateView(); m_preview.SetFocus(); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void TestMater() { int nOldVal=DocGetDrawMode(); DocSetDrawMode(DRAW_2D); CTemporaryResourceOverride vTemp; CTestDlg dlg; dlg.DoModal(); DocSetDrawMode(nOldVal); } void CTestDlg::OnDestroy() { CDialog::OnDestroy(); // TODO: Add your message handler code here } BOOL CTestDlg::DestroyWindow() { m_preview.clearAll(); return CDialog::DestroyWindow(); }