Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4625481
  • 博文数量: 671
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 7310
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-14 09:56
文章分类

全部博文(671)

文章存档

2011年(1)

2010年(2)

2009年(24)

2008年(271)

2007年(319)

2006年(54)

我的朋友

分类: C/C++

2007-10-08 17:41:12

 

Introduction

This is my first article for the CodeProject, so please excuse me if it is really hard to understand. But I am always ready to help you on this.

Using this simple Tab control you can manage your panes separately. The most interesting thing is that you do not need to concentrate separately on your Tab control. Create your tab windows as normal dialog boxes, then you can link those dialogs to the Tab control by simply using the code given below. Set your dialog properties as follows: (dialogs to be displayed as tab panes)

  • Border: None
  • Title Bar: False
  • System Menu: False
  • Style: Popup

The client edge and other edge styles can be set according to your needs. Those edge styles will be a reflection of your tab pane.

// In your main dialog (where your Tab Control is) in OnInitDialog 
// write these simple lines to add your dialogs to Tab Panes.
   p1 = new CTabPageOne(); //p1 is a pointer to CTabPageOne (Dialog Box) 
   p1->Create(IDD_DIALOG_PAGE1,m_ctrlTAB.GetWindow(IDD_DIALOG_PAGE1));
   p2 = new CTabPageTwo(); //p1 is a pointer to CTabPageOne (Dialog Box) 
   p2->Create(IDD_DIALOG_PAGE2,m_ctrlTAB.GetWindow(IDD_DIALOG_PAGE2));

Add the above dialog boxes to your Tab control. Your Tab control is created from CibTabCtrl.

m_ctrlTAB.AddTabPane("Tab Intro",p1);
m_ctrlTAB.AddTabPane("My Tab Pages",p2);

There are two more things to do. That is, add the OnMove event to your main dialog box using your class wizard:

void CTabDlg::OnMove(int x, int y)
{
    m_ctrlTAB.OnMove(x,y);
}

Now, add the OnShowWindow event to your main dialog box using your class wizard.

void CTabDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
    CDialog::OnShowWindow(bShow, nStatus); 
    m_ctrlTAB.SetDefaultPane(1);
}

Foooo... That's all you have to do. Now you can run and see your output. Hope it works for you!

阅读(934) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~