当前位置:网站首页>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;
}
至此,就可以看到其简单的效果,没有美化:
边栏推荐
- 26. 删除有序数组中的重复项 C#解答
- BI技巧丨权限轴
- Shell 编程核心技术《二》
- The 15th youth informatics competition in Shushan District in 2019
- The 300th weekly match of leetcode (20220703)
- Explore the contour drawing function drawcontours() of OpenCV in detail with practical examples
- Mysql database basic operation -ddl | dark horse programmer
- 一文掌握数仓中auto analyze的使用
- 1005 Spell It Right(20 分)(PAT甲级)
- 876. 链表的中间结点
猜你喜欢
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
TCP两次挥手,你见过吗?那四次握手呢?
Pytorch学习(四)
BI技巧丨权限轴
Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?
牛客小白月赛7 谁是神箭手
FPGA时序约束分享01_四大步骤简述
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
Several methods of online database migration
Detailed explanation of the binary processing function threshold() of opencv
随机推荐
2021 合肥市信息学竞赛小学组
HDU 6440 2018 Chinese college student program design network competition
There are multiple divs in the large div, which are displayed on the same line. After overflow, scroll bars are generated without line breaks
用实际例子详细探究OpenCV的轮廓绘制函数drawContours()
求2的n次方
1007 Maximum Subsequence Sum(25 分)(PAT甲级)
2022CoCa: Contrastive Captioners are Image-Text Fountion Models
LeetCode FizzBuzz C#解答
线上数据库迁移的几种方法
函数式接口
The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
Unity editor extends C to traverse all pictures in folders and subdirectories
Shell 编程核心技术《四》
联想首次详解绿色智城数字孪生平台 破解城市双碳升级难点
在线文本行固定长度填充工具
92.(cesium篇)cesium楼栋分层
Educational Codeforces Round 22 E. Army Creation
The CDC of sqlserver can read the data for the first time, but it can't read the data after adding, deleting and modifying. What's the reason
1003 Emergency(25 分)(PAT甲级)
牛客小白月赛7 I 新建 Microsoft Office Word 文档