colorcombobox.h
来自「深入浅出Visual C++入门进阶与应用实例 随书光盘 作者 何志丹」· C头文件 代码 · 共 57 行
H
57 行
#if !defined(AFX_COLORCOMBOBOX_H__24D3E790_EA53_4C5C_B820_30C68B687A9E__INCLUDED_)
#define AFX_COLORCOMBOBOX_H__24D3E790_EA53_4C5C_B820_30C68B687A9E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ColorComboBox.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CColorComboBox window
#include "Afxtempl.h"
typedef struct CBITEM //一种颜色的信息
{
int iIndex;//此项在组合框的索引
COLORREF crColor;//颜色
CString strColorName;//颜色名称
}CBITEM, *LPCBITEM;
class CColorComboBox : public CComboBox//颜色组合框
{
public:
CColorComboBox();
virtual ~CColorComboBox();
void InitColorCB();//初始化颜色组合框
void AddAColor(CString strColorName , COLORREF crColor);//增加一种颜色
bool DeleteAColor(int iIndex);//删除一种颜色
COLORREF GetColor();//取得选中颜色
LPCBITEM GetItemInfo(int iIndex);//根据索引取得颜色信息
//{{AFX_VIRTUAL(CColorComboBox)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_VIRTUAL
protected:
CArray<LPCBITEM,LPCBITEM> m_crItem;//颜色项数组
int iIconX, iIconY; //图标的大小
COLORREF m_crColor; //当前选中的颜色
//{{AFX_MSG(CColorComboBox)
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSelchange();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLORCOMBOBOX_H__24D3E790_EA53_4C5C_B820_30C68B687A9E__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?