在此之前我使用分割視窗類,將客戶區分割成了兩部分,其中一部分建立了CMyFormView 類,里面屬性表單。這就是添加屬性頁的創建函式
int CMyFormView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您專用的創建代碼
CRect rect;
GetWindowRect(&rect);
CRgn rgn;
m_propSheet = new CMyPropSheet(_T("wxm"));
m_propSheet->AddPage(&m_prop1);
m_propSheet->AddPage(&m_prop2);
//p_propSheet->Create(this,DS_CONTEXTHELP | DS_SETFONT | WS_CHILD | WS_VISIBLE);
m_propSheet->Create(this, WS_CHILD | WS_VISIBLE,0);
m_propSheet->ModifyStyleEx(0,WS_TABSTOP);
m_propSheet->ModifyStyle(0,WS_THICKFRAME|WS_SYSMENU);//
m_propSheet->SetWindowPos(NULL,0,0,rect.right-rect.left,rect.bottom-rect.top,SWP_NOACTIVATE);
CTabCtrl* m_tabctrl=m_propSheet->GetTabControl( );//
m_tabctrl->SetWindowPos(NULL,0,0,rect.right-rect.left,rect.bottom-rect.top,SWP_NOACTIVATE);//
return 0;
}
下面是檔案類中的部分程式,
CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd;
CCenter_pickupView *pView=(CCenter_pickupView *)pMain->GetActiveView();
CCenter_pickupDoc *pDoc=pView->GetDocument();
CString str1,str2,str3;
str1.Format(_T("%.3f"),theApp.probe_coordinate.x);
str2.Format(_T("%.3f"),theApp.probe_coordinate.y);
str3.Format(_T("%.3f"),theApp.probe_coordinate.z);
CMyFormView *pFormView=(CMyFormView *)pMain->GetActiveView();
while(!pFormView-> IsKindOf(RUNTIME_CLASS(CMyFormView)))
{
CMyFormView *pFormView=(CMyFormView *)pMain->GetActiveView();
}
pFormView->m_prop2.GetDlgItem(IDC_EDIT_PROBE_X1)->SetWindowText(str1);
pFormView->m_prop2.GetDlgItem(IDC_EDIT_PROBE_Y1)->SetWindowText(str2);
pFormView->m_prop2.GetDlgItem(IDC_EDIT_PROBE_Z1)->SetWindowText(str3);
編譯沒有問題,但是運行到倒數第三行的時候,就會報錯Debug Assertion Failed那個對話框。。。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/125614.html
標籤:基礎類
上一篇:StringGrid與Txt
下一篇:C++讀取檔案
