当前位置:网站首页>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 .
边栏推荐
- tmux -- ssh terminal can be closed without impact the server process
- redis连接错误:ERR Client sent AUTH, but no password is set解决方案2个
- Machine learning note 8: octave for handwritten digit recognition based on Neural Network
- Test platform composed of time sequence
- JTAG接口
- P1061 [noip2006 popularization group] counting method of jam
- 机器学习笔记 六:逻辑回归中的多分类问题之数字识别
- MATLAB系统辨识
- Bat 常用批处理脚本记录
- Trigger
猜你喜欢
随机推荐
Test platform for combinational logic blocks
Non transitive dice (spring daily question 51)
单精度,双精度和精度(转载)
Record some problems and solutions encountered in processing SIF data
數據的存儲(進階)
机器学习笔记 八:Octave实现神经网络的手写数字识别
Vue des nombres élevés du point de vue de l'espace vectoriel (1) - - Introduction à la série
Frame profiling
以太网UDP帧发包设计
Clion installation Download
\[\e]0; \[email protected]\h: \w\a\]\[\033[01;32m\]\[email protected]\h\[\033[
n个整数的无序数组,找到每个元素后面比它大的第一个数,要求时间复杂度为O(N)
Machine learning Note 6: number recognition of multiple classification problems in logistic regression
Unity 加密ASE 游戏数据
Implementation of lazy loading of pictures (summary and sorting)
Reptile initial and project
Linear regression: least squares, Tellson estimation, RANSAC
Signal output library
Analysis of annual average temperature based on TMP data in cru
Vscode minimalist installation tutorial









