当前位置:网站首页>MFC TabCtrl 控件修改標簽尺寸
MFC TabCtrl 控件修改標簽尺寸
2022-06-22 05:55:00 【Phenixyf】
注意:無論那種方法,都要先設置Tab控件的Style屬性為fixed width.

第一種方法
MFC,tabcontrol控件改變標簽大小 - CSDN博客
MFC,tabcontrol控件改變標簽大小_帆帆鄭的博客-CSDN博客_mfc tabcontrol大小
CSize size, size1;
size.cx = 150;
size.cy = 40;
size1 = m_tab.SetItemSize(size);第二種方法
MSDN:About Tab Controls (Windows) About Tab Controls - Win32 apps | Microsoft Docs
進入MSDN 關於Tab Control 的官方頁面,找到我們需要的修改標簽比特置和尺寸。

通過SetItemSize函數可以精確的設置Tab標簽的尺寸。

點擊進入這個函數的說明:

這一頁沒有實質的內容,繼續點擊進入詳情頁,終於有了說明:

於是在程序裏這麼寫:
TabCtrl_SetItemSize(m_tab, 150, 40);其中m_tab是控件關聯的變量。
注意要設置Tab控件區域中子對話框rs.top的數值要與設置的Tab標簽高度一致:
這裏都設置為40,否則會出現留白或者標簽的字被遮擋。
//獲得IDC_TABTEST客戶區大小
CRect rs;
m_tab.GetClientRect(&rs);
//CWnd *pWnd = GetDlgItem(IDC_TAB_MAIN);
//pWnd->GetWindowRect(&rs);//獲取控件的屏幕坐標
//cout << "Tab: " << rs.top << "," << rs.left << "," << rs.Width() << "," << rs.Height() << endl;
//調整子對話框在父窗口中的比特置
rs.top += 40;
rs.bottom -= 1;
rs.left -= 1;
rs.right -= 1;
//Tab
m_tab.InsertItem(0, _T(" 通訊 \n"));
m_ControlDlg.Create(IDD_DIALOG_CONTROL, GetDlgItem(IDC_TAB_MAIN));
//設置子對話框尺寸並移動到指定比特置
m_ControlDlg.MoveWindow(&rs);边栏推荐
- 我不建议你工作太拼命
- Grabcut analysis
- Implementation of Nacos server source code
- I2C接口
- Analysis of annual average temperature based on TMP data in cru
- Learning method 4 for promotion of big factories: play learning method
- Unity 加密ASE 游戏数据
- The first week of wechat applet development: page setup, page Jump and data binding
- 数据的存储(进阶)
- MySQL basic interview questions
猜你喜欢

RGB及sRGB与XYZ坐标转换

AUTOSAR从入门到精通100讲(150)-SOA架构及应用

Implementation of Nacos server source code

Grabcut analysis

错误:note: module requires Go 1.17

以太网UDP帧发包设计

爬虫初始及项目

Machine learning Note 6: number recognition of multiple classification problems in logistic regression

Working method: 3C scheme design method

System identification of automatic control principle
随机推荐
I2C接口
P1061 [noip2006 popularization group] counting method of jam
Link a static library‘s all sections
MATLAB系统辨识
A simple method to implement deep cloning and encapsulation of objects JS
基于CRU中的tmp数据进行年平均气温分析
Vscode remote connection error: server status check failed - waiting and retrying
空调(春季每日一题 50)
JTAG接口
Machine learning Note 6: number recognition of multiple classification problems in logistic regression
Signal output library
Tensorflow 2. Chapter 14: callbacks and custom callbacks in keras
From "platform transformation" to "DTC brand going to sea", what is the trend of 2021?
Go语言使用JWT
Grabcut analysis
count registers in C code -- registers has one pattern
Remove then add string from variable of Makefile
Non transitive dice (spring daily question 51)
tmux -- ssh terminal can be closed without impact the server process
机器学习笔记 六:逻辑回归中的多分类问题之数字识别