标签:div fct ret creat create 页面 ctr item nbsp
xxxDlg.h
public: CTabCtrl m_tabctrl; #define MAX_DLG_PAGE 2 CDialog* m_pDialog[MAX_DLG_PAGE]; int m_iSelectedPage; CPageProcess m_pageProcess; CPageFile m_pageFile;
xxxDlg.cpp
BOOL CDemoTabCtrlDlg::OnInitDialog() { //... //插入页标题 m_tabctrl.InsertItem(0, _T("Process")); m_tabctrl.InsertItem(1, _T("File")); //页面绑定对话框,对话框绑定类,对话框Border(None),Style(Child) m_pageProcess.Create(IDD_DIALOG1, &m_tabctrl); m_pageFile.Create(IDD_DIALOG2, &m_tabctrl); //设置页面的位置在m_tabctrl控件范围内 CRect rc; m_tabctrl.GetClientRect(rc); rc.top += 30; rc.bottom -= 5; rc.left += 5; rc.right -= 5; m_pDialog[0] = &m_pageProcess; m_pDialog[1] = &m_pageFile; m_pDialog[0]->MoveWindow(&rc); m_pDialog[1]->MoveWindow(&rc); //默认显示页 m_pDialog[0]->ShowWindow(TRUE); m_pDialog[1]->ShowWindow(FALSE); return TRUE; // 除非将焦点设置到控件,否则返回 TRUE } void CDemoTabCtrlDlg::OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult) { m_pDialog[m_iSelectedPage]->ShowWindow(SW_HIDE); m_iSelectedPage = m_tabctrl.GetCurSel(); if (m_pDialog[m_iSelectedPage]) { m_pDialog[m_iSelectedPage]->ShowWindow(SW_SHOW); } *pResult = 0; }
标签:div fct ret creat create 页面 ctr item nbsp
原文地址:http://www.cnblogs.com/nonebutnow/p/6006126.html