当前位置:网站首页>BCG 使用之CBCGPTabWnd控件(相当于MFC TabControl)
BCG 使用之CBCGPTabWnd控件(相当于MFC TabControl)
2022-07-04 18:32:00 【春蕾夏荷_728297725】
1、新建子对话框并修改属性,同时新建一个类NyPage1
2、在新建项目默认类的对话框中,添加一个pic控件并修改隐藏属性
3、修改默认类的内容:
(1)头文件中
添加析构函数:
~CBCGTabWndSampleDlg()
{
if (_NyPage1 != nullptr)
{
delete _NyPage1;
_NyPage1 = nullptr;
}
if (_NyPage2 != nullptr)
{
delete _NyPage2;
_NyPage2 = nullptr;
}
}
定义成员:
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)实现文件中
消息响应
N_REGISTERED_MESSAGE(BCGM_ON_MOVE_TAB, CBCGTabWndSampleDlg::OnMoveTab)
//切换tab响应事件
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("第一页"), 0);
_NyPage2 = new NyPage1();
_NyPage2->Create(NyPage1::IDD, &m_wndTab);
m_wndTab.AddTab(_NyPage2, _T("第二页"), 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;
}
至此,就可以看到其简单的效果,没有美化:
边栏推荐
- 1006 Sign In and Sign Out(25 分)(PAT甲级)
- HDU 1097 A hard puzzle
- 偏移量函数及开窗函数
- Some thoughts on whether the judgment point is located in the contour
- Online data migration scheme encountered in the project 1 - general idea sorting and technical sorting
- Shell 编程核心技术《一》
- Wireshark网络抓包
- HDU 1372 & POJ 2243 Knight Moves(广度优先搜索)
- 1011 World Cup Betting (20 分)(PAT甲级)
- 长城证券开户安全吗 买股票怎么开户
猜你喜欢
Introduction to polyfit software
Some thoughts on whether the judgment point is located in the contour
TCP两次挥手,你见过吗?那四次握手呢?
在线SQL转Excel(xls/xlsx)工具
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
How to use async Awati asynchronous task processing instead of backgroundworker?
欧拉函数
To sort out messy header files, I use include what you use
Stream stream
MySQL数据库基本操作-DDL | 黑马程序员
随机推荐
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Unity给自己的脚本添加类似编辑器扩展的功能案例ContextMenu的使用
Comment utiliser async awati asynchrone Task Handling au lieu de backgroundworker?
Lm10 cosine wave homeopathic grid strategy
函数式接口
Unity编辑器扩展C#遍历文件夹以及子目录下的所有图片
矩阵翻转(数组模拟)
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
Stream流
在线SQL转Excel(xls/xlsx)工具
MySQL数据库基本操作-DDL | 黑马程序员
如何使用Async-Awati异步任務處理代替BackgroundWorker?
长城证券开户安全吗 买股票怎么开户
Personal thoughts on Architecture Design (this article will be revised and updated continuously later)
How test engineers "attack the city" (Part 2)
BCG 使用之新建向导效果
1002. A+B for Polynomials (25)(PAT甲级)
Hough transform Hough transform principle
数组中的第K个最大元素
Guys, for help, I use MySQL CDC 2.2.1 (Flink 1.14.5) to write Kafka and set