TabControl添加属性页时,注意:所要添加的对话框一定是样式为“下层”,边框为“细小”,或是“无”,否则添加不到Tab中去。添加代码:如下
//Tab控件定义各个名称
m_TabControl.InsertItem(0,_T("Ethernet II"));
m_TabControl.InsertItem(1,_T("VLAN and MPLS"));
//将创建的对话框添加到Tab中
EthernetDlg.Create(IDD_DIALOG_STEthernetII, &m_TabControl);
VMDlg.Create(IDD_DIALOG_STVLANMPLS, &m_TabControl);
//设置各个对话框在Tab中的位置
CRect rec;
m_TabControl.GetClientRect(rec);
rec.top +=20;
rec.bottom -= 10;
rec.right += 10;
rec.left -= 10;
EthernetDlg.MoveWindow(&rec);
VMDlg.MoveWindow(&rec);
//显示对话框
EthernetDlg.ShowWindow(SW_SHOW);
VMDlg.ShowWindow(SW_HIDE);