1. 程式人生 > 其它 >單文件或者多文件控制自帶屬性視窗的顯示

單文件或者多文件控制自帶屬性視窗的顯示

技術標籤:MFC

在這裡插入圖片描述
建立一個單文件或者多文件工程之後,會自帶CPropertiesWnd屬性視窗,使用過程中點了關閉,發現不能在顯示了,關閉工程重新開啟也不行。必須把相關程式碼註釋掉才可以。

後來問百度,可以用ShowPane解決,以下是我的處理過程:

1.View部分,點選之後訊息函式裡寫

CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
CPropertiesWnd* myWndProperties = pMainFrame->GetPropertiesWnd();
myWndProperties->ShowPane
(true, false, false); myWndProperties->InitPropList();

2.MainFrame里加函式宣告

public:
CPropertiesWnd* GetPropertiesWnd();

3.新增函式實現

CPropertiesWnd* CMainFrame::GetPropertiesWnd()
{ 

CPropertiesWnd* pView = &m_wndProperties;

return pView;

}

4.解決。