// Browse2DScriptDlg.cpp : implementation file // #include "stdafx.h" #include "geomative.h" #include "Browse2DScriptDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CBrowse2DScriptDlg dialog CBrowse2DScriptDlg::CBrowse2DScriptDlg(CWnd* pParent /*=NULL*/) : CDialog(CBrowse2DScriptDlg::IDD, pParent) { //{{AFX_DATA_INIT(CBrowse2DScriptDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT m_BrowseScript = NULL; } void CBrowse2DScriptDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBrowse2DScriptDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CBrowse2DScriptDlg, CDialog) //{{AFX_MSG_MAP(CBrowse2DScriptDlg) ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_EASYSIZE_MAP(CBrowse2DScriptDlg) EASYSIZE(IDC_STATIC_BROWSE, ES_BORDER, ES_BORDER, ES_BORDER,ES_BORDER,0) END_EASYSIZE_MAP ///////////////////////////////////////////////////////////////////////////// // CBrowse2DScriptDlg message handlers BOOL CBrowse2DScriptDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CRect rect; CWnd *pStatic = this->GetDlgItem(IDC_STATIC_BROWSE); this->GetWindowRect(&rect); // pStatic->DestroyWindow(); this->ScreenToClient(&rect); DWORD dwStyle = AFX_WS_DEFAULT_VIEW; CRuntimeClass* pClass = (CRuntimeClass*)RUNTIME_CLASS(CBrowse2DScriptView); m_BrowseScript = (CBrowse2DScriptView*)pClass->CreateObject(); m_BrowseScript->Create(NULL, NULL, dwStyle, rect, this, CBrowse2DScriptDlg::IDD); m_BrowseScript->OnInitialUpdate(); m_BrowseScript->EnableWindow(TRUE); m_BrowseScript->ShowWindow(SW_SHOW); this->ShowWindow(SW_SHOWMAXIMIZED); INIT_EASYSIZE; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } BOOL CBrowse2DScriptDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN) { return TRUE; } return CDialog::PreTranslateMessage(pMsg); } void CBrowse2DScriptDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here if (m_BrowseScript) { // CRect rect; // this->GetWindowRect(&rect); // this->ScreenToClient(&rect); // rect.top += 40; // rect.left += 10; // rect.right -= 10; // rect.bottom -= 10; CRect rect; CWnd *pStatic = this->GetDlgItem(IDC_STATIC_BROWSE); this->GetWindowRect(&rect); // pStatic->DestroyWindow(); this->ScreenToClient(&rect); m_BrowseScript->MoveWindow(rect); } UPDATE_EASYSIZE; }