⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectctrl.h

📁 RFID读标示例
💻 H
字号:
// SelectCtrl.h: interface for the CSelectCtrl class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SELECTCTRL_H__8707E5D8_A82E_466D_BC43_2C7C772A8A02__INCLUDED_)
#define AFX_SELECTCTRL_H__8707E5D8_A82E_466D_BC43_2C7C772A8A02__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <ufc/ucontrol.h>
#include <ubase.h>

//距离左边框距离
const int __LEFT_DISTANCE__ = 5;
//距离右边框距离
const int __RIGHT_DISTANCE__ = 5;
//距离顶边框的距离
const int __TOP_DISTANCE__ = 5;
//间隔距离
const int __SPACE_DISTANCE__ = 2;

//字和边框的间距 
const int __WORD_SQU_DISTANCE__ = 5;
//显示边框风格
#define __SELECT_DASHFRAME__ (1<<2)       //虚线边框
#define __SELECT_REALFRAME__ (1<<3)       //实线边框
#define __SELECT_MIDDLE__  (1<<4)         //选项居中对其
#define __SELECT_WORD_LINEFRAME__ (1<<5)  //选定文字的边框(线框)
#define __SELECT_WORD_DASHFRAME__ (1<<6)  //选定文字的边框(虚线)
#define __SELECT_WORD_BLACKFRAME__  (1<<7)  //选定文字的背景黑色,字白色

const int select_max_item_count = 6;  //最多六个选择
const int select_item_height = 13;    //选项文字高度

class CSelectCtrl : public CUControl  
{
public:
	CSelectCtrl();
	virtual ~CSelectCtrl();


	virtual int WinProc(UMSG *pMsg);	
	virtual int Create(CUWin * pWndParent = (CUWin *)NULL,
								const char *szName = (const char *)NULL,
								int nStyle = 0,
								RECT *pRect = (RECT *)NULL,
								int nParam = 0);
	virtual void Show();
	virtual BOOL AddString(const char* pstrItemText);   //添加项
	virtual int GetCurSel();                            //得到当前的选择项
	virtual void SetCurSel(int n);                      //设置当前的选择项
	virtual void SetParam(int nTop /*距离上边框的距离*/,
						int nLeft  /*距离左边框的距离*/,
						int nWordSqu /*文字和方框之间的距离*/); //注:此函数在选定居中时无效
	virtual char* GetCurSelTextPtr();                   //得到当前选择项的文本
	virtual char* GetTextPtr(int n);                    //得到指定选择项的文本

protected:	
	virtual void OnPaint(void);
	virtual void OnKey(UMSG * pMsg);

private:
	void GetDistanceHeight(CUDC *pdc);   //得到居中显示间隔宽度

private:
//	BOOL m_bIsFrame;
	int m_bFrameStyle;     //边框风格0:无边框 1:实线 2:虚线
	BOOL m_bIsMiddle;
	int m_nTotalItem;
	char *m_pstrItemText[select_max_item_count];
	RECT m_Setrect;
	int m_nCurrent;
	int m_nWordSqu;
	int m_nWordFrame;       //选定的文字边框类型 0:无边框 1:线边框 2:虚线边框 3:黑色
};

#endif // !defined(AFX_SELECTCTRL_H__8707E5D8_A82E_466D_BC43_2C7C772A8A02__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -