CRect r; m_page1.Create(CPage1::IDD,this); m_page2.Create(CPage2::IDD,this); m_page1.GetClientRect(&r); r.OffsetRect(40,40); // ここの数字は適宜直す m_page1.MoveWindow(&r,FALSE); m_page2.MoveWindow(&r,FALSE); CTabCtrl* pTab = (CTabCtrl*)GetDlgItem(IDC_TAB); pTab->InsertItem(0,"Page1"); pTab->InsertItem(1,"Page2"); OnSelchangeTab(0,0);
void CXXX::OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult) { if (pResult) *pResult = 0; CTabCtrl* pTab = (CTabCtrl*)GetDlgItem(IDC_TAB); int i = pTab->GetCurSel(); m_page1.ShowWindow(i == 0 ? SW_SHOW : SW_HIDE); m_page2.ShowWindow(i == 1 ? SW_SHOW : SW_HIDE); }