如图,这是一个软件界面的截图,我想模仿这个界面自己写个软件。现在碰到了个问题,想请教一下。
我用分割条将页面分成了三部分,分别是上、左、右三部分,在左边这部分中使用了Tab控件,想用Tab控件实现右边部分的页面的切换(右边部分准备了三个formview类型的对话框),但是当程序运行时点击Tab控件的按钮就会出现问题。想请问前辈,这该怎么修改?
这是实现切换的代码:
void CFormview3::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_tab.InsertItem(0,"参数一");
m_tab.InsertItem(1,"参数二");
m_tab.InsertItem(2,"结果");
}
void CFormview3::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int CurSel = m_tab.GetCurSel();
switch(CurSel)
{
case 0:
m_formview2.ShowWindow(SW_SHOW);
m_formview4.ShowWindow(SW_HIDE);
m_formview5.ShowWindow(SW_HIDE);
break;
case 1:
m_formview2.ShowWindow(SW_HIDE);
m_formview4.ShowWindow(SW_SHOW);
m_formview5.ShowWindow(SW_HIDE);
break;
case 2:
m_formview2.ShowWindow(SW_HIDE);
m_formview4.ShowWindow(SW_HIDE);
m_formview5.ShowWindow(SW_SHOW);
break;
default:
; }
*pResult = 0;
}
3 个解决方案
#1
没人回帖,自己回一个,问题自己也解决了
#2
void CFormview3::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_tab.InsertItem(0,"参数一");
m_tab.InsertItem(1,"参数二");
m_tab.InsertItem(2,"结果");
m_AAAPage.Create(AAA_ID, GetDlgItem(XXXTab_ID)); //参数一项对应的对话框
m_BBBPage.Create(BBB_ID, GetDlgItem(XXXTab_ID)); //参数二项对应的对话框
m_CCCPage.Create(CCC_ID, GetDlgItem(XXXTab_ID)); //结果项对应的对话框
}
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_tab.InsertItem(0,"参数一");
m_tab.InsertItem(1,"参数二");
m_tab.InsertItem(2,"结果");
m_AAAPage.Create(AAA_ID, GetDlgItem(XXXTab_ID)); //参数一项对应的对话框
m_BBBPage.Create(BBB_ID, GetDlgItem(XXXTab_ID)); //参数二项对应的对话框
m_CCCPage.Create(CCC_ID, GetDlgItem(XXXTab_ID)); //结果项对应的对话框
}
#3
#1
没人回帖,自己回一个,问题自己也解决了
#2
void CFormview3::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_tab.InsertItem(0,"参数一");
m_tab.InsertItem(1,"参数二");
m_tab.InsertItem(2,"结果");
m_AAAPage.Create(AAA_ID, GetDlgItem(XXXTab_ID)); //参数一项对应的对话框
m_BBBPage.Create(BBB_ID, GetDlgItem(XXXTab_ID)); //参数二项对应的对话框
m_CCCPage.Create(CCC_ID, GetDlgItem(XXXTab_ID)); //结果项对应的对话框
}
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_tab.InsertItem(0,"参数一");
m_tab.InsertItem(1,"参数二");
m_tab.InsertItem(2,"结果");
m_AAAPage.Create(AAA_ID, GetDlgItem(XXXTab_ID)); //参数一项对应的对话框
m_BBBPage.Create(BBB_ID, GetDlgItem(XXXTab_ID)); //参数二项对应的对话框
m_CCCPage.Create(CCC_ID, GetDlgItem(XXXTab_ID)); //结果项对应的对话框
}