当前位置:网站首页>MFC tab control add Icon
MFC tab control add Icon
2022-06-22 05:56:00 【Phenixyf】
1. take icon picture copy To the project directory res Folder and import


2. In the dialog box .h Add... To the file CImageList object
as follows CImageList m_TabImageList;
#pragma once
// Chart Dialog box
class Chart : public CDialogEx
{
DECLARE_DYNAMIC(Chart)
public:
Chart(CWnd* pParent = NULL); // Standard constructors
virtual ~Chart();
// Dialog data
enum { IDD = IDD_CHART1};
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Support
DECLARE_MESSAGE_MAP()
public:
virtual BOOL OnInitDialog();
CTabCtrl m_tab;
//*****************************
CImageList m_TabImageList;
//*****************************
};3. In the dialog box .cpp file OnInitDialog Add the following code to the function
BOOL Chart::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: Add additional initialization here
//*********************************
//Creat(int cx, int cy, UINT nFlags, int How many? tab Write a few , int For expansion , Non dynamic tab 0 Just fine , One expansion nGrow individual )
m_TabImageList.Create(24, 24, ILC_COLOR32 | ILC_MASK, 2, 0);
HICON hIcon1, hIcon2, hIcon3;
hIcon1 = AfxGetApp()->LoadIcon(IDI_ICON1);
hIcon2 = AfxGetApp()->LoadIcon(IDI_ICON2);
SetIcon(hIcon1, TRUE);
m_TabImageList.Add(hIcon2);
m_TabImageList.Add(hIcon3);
m_tab.SetImageList(&m_TabImageList);
m_tab.InsertItem(0, _T("Tab1"), 0);
m_tab.InsertItem(1, _T("Tab2"), 1);
//*********************************
return TRUE; // return TRUE unless you set the focus to a control
// abnormal : OCX The property page should return FALSE
}Be careful : InsertItem Function must use a 3 Overloaded function with two parameters , The first 3 Parameters indicate which icon to use .
边栏推荐
- Beifeng helps Nanchang Emergency Management Bureau to build a public-private integrated emergency communication guarantee network
- nacos server 源码运行实现
- Development forecast and investment risk outlook report of China's GaAs industry during the 14th Five Year Plan period 2022-2027
- Network, IO flow, reflection, multithreading, exception
- Trigger
- D3D10 截图功能 保存Texture到本地
- BinaryFormatter 保存和加载游戏数据 For Unity
- 400-哈希表(1. 两数之和、454. 四数相加 II、383. 赎金信)
- Assertion based validation
- Adaboost
猜你喜欢

服务器php相关网页开发环境搭建

Delete the packaging use of pop-up components

U disk as startup disk to reinstall win10 system (no other software required)

I2C接口

Xshell download and installation (solve the problem of expired evaluation)

RGB及sRGB与XYZ坐标转换

I don't suggest you work too hard

I2C interface

Stockage des données (avancé)

串口(RS - 232)
随机推荐
Dos Bat 语法记录一
机器学习笔记 六:逻辑回归中的多分类问题之数字识别
Optimization direction of code walk through (convenient interface requests, long dynamic class judgment conditions, removal of useless consoles, separation of public methods)
Trigger
Serial port (RS - 232)
组合逻辑块的测试平台
tmux -- ssh terminal can be closed without impact the server process
Go language uses JWT
Implementation of Nacos server source code
Delete the packaging use of pop-up components
空调(春季每日一题 50)
Unity app提高设备可用性
基于断言的验证
idea插件EasyCode的使用
A reminder to cross-border sellers who are still "shopping"!
Reptile initial and project
向量空间视角看高数(1)——系列简介
以太网通信协议
Development prospect and investment potential prediction report of China's rare earth permanent magnet industry during the "14th five year plan" period 2022-2027
OPTEE notes