当前位置:网站首页>Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
2022-07-04 19:42:00 【Spring buds and summer lotus_ seven hundred and twenty-eight mi】
1、 Create a new sub dialog box and modify the properties , Create a new class at the same time NyPage1


2、 In the dialog box of new project default class , Add one pic Control and modify hidden properties

3、 Modify the contents of the default class :
(1) Header file
Add destructor :
~CBCGTabWndSampleDlg()
{
if (_NyPage1 != nullptr)
{
delete _NyPage1;
_NyPage1 = nullptr;
}
if (_NyPage2 != nullptr)
{
delete _NyPage2;
_NyPage2 = nullptr;
}
}
Define members :
CBCGPTabWnd m_wndTab;
NyPage1 *_NyPage1;
NyPage1 *_NyPage2;
afx_msg LRESULT OnMoveTab(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnChangeActiveTab(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnRenameTab(WPARAM wp, LPARAM lp);
afx_msg LRESULT OnChangeTabSelection(WPARAM wp, LPARAM lp);
(2) In the implementation file
Message response
N_REGISTERED_MESSAGE(BCGM_ON_MOVE_TAB, CBCGTabWndSampleDlg::OnMoveTab)
// Switch tab Responding to events
ON_REGISTERED_MESSAGE(BCGM_CHANGE_ACTIVE_TAB, CBCGTabWndSampleDlg::OnChangeActiveTab)
ON_REGISTERED_MESSAGE(BCGM_ON_RENAME_TAB, CBCGTabWndSampleDlg::OnRenameTab)
ON_REGISTERED_MESSAGE(BCGM_CHANGE_TAB_SELECTION, CBCGTabWndSampleDlg::OnChangeTabSelection)
BOOL CBCGTabWndSampleDlg::OnInitDialog()
{
CBCGPDialog::OnInitDialog();
CRect rectTab;
GetDlgItem(IDC_TAB)->GetWindowRect(&rectTab);
ScreenToClient(&rectTab);
m_wndTab.Create(CBCGPTabWnd::STYLE_3D, rectTab, this, 1, CBCGPTabWnd::LOCATION_TOP);
{
_NyPage1 = new NyPage1();
_NyPage1->Create(NyPage1::IDD, &m_wndTab);
m_wndTab.AddTab(_NyPage1, _T(" first page "), 0);
_NyPage2 = new NyPage1();
_NyPage2->Create(NyPage1::IDD, &m_wndTab);
m_wndTab.AddTab(_NyPage2, _T(" The second page "), 1);
}
m_wndTab.SetActiveTab(0);
m_wndTab.RecalcLayout();
m_wndTab.RedrawWindow();
return TRUE; // return TRUE unless you set the focus to a control
}
LRESULT CBCGTabWndSampleDlg::OnMoveTab(WPARAM wp, LPARAM lp)
{
return 1;
}
LRESULT CBCGTabWndSampleDlg::OnChangeActiveTab(WPARAM wp, LPARAM lp)
{
return 1;
}
LRESULT CBCGTabWndSampleDlg::OnRenameTab(WPARAM wp, LPARAM lp)
{
return 1;
}
LRESULT CBCGTabWndSampleDlg::OnChangeTabSelection(WPARAM wp, LPARAM lp)
{
return 1;
}
thus , You can see its simple effect , No beautification :

边栏推荐
- Introduction to polyfit software
- 如何使用Async-Awati异步任务处理代替BackgroundWorker?
- Specify the character set to output
- Niuke Xiaobai monthly race 7 I new Microsoft Office Word document
- The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize
- Personal thoughts on Architecture Design (this article will be revised and updated continuously later)
- socket编程demo二
- FTP, SFTP file transfer
- How test engineers "attack the city" (Part 2)
- ACM组合计数入门
猜你喜欢

Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading

HMM隐马尔可夫模型最详细讲解与代码实现

Online text line fixed length fill tool

Swagger suddenly went crazy

SSRS筛选器的IN运算(即包含于)用法

Multi table operation inner join query

English grammar_ Noun - use

Several methods of online database migration

如何使用Async-Awati异步任务处理代替BackgroundWorker?

“只跑一趟”,小区装维任务主动推荐探索
随机推荐
Educational Codeforces Round 22 E. Army Creation
Pointnet/Pointnet++点云数据集处理并训练
牛客小白月赛7 E Applese的超能力
求2的n次方
kotlin 基本使用
1009 Product of Polynomials(25 分)(PAT甲级)
1009 product of polynomials (25 points) (PAT class a)
Oracle with as ORA-00903: invalid table name 多表报错
Hough Transform 霍夫变换原理
Pytorch学习(四)
1005 Spell It Right(20 分)(PAT甲级)
偏移量函数及开窗函数
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
C # use stopwatch to measure the running time of the program
Shell programming core technology "I"
C# 使用StopWatch测量程序运行时间
Stream stream
YOLOv5s-ShuffleNetV2
安徽 中安在线文旅频道推出“跟着小编游安徽”系列融媒体产品
1008 Elevator(20 分)(PAT甲级)