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

📄 xcell.h

📁 一个简单方便的表格控件
💻 H
字号:
#pragma once

//alignment define
static const int ALIGN_LEFT = DT_LEFT; //0
static const int ALIGN_CENTER = DT_CENTER; //
static const int ALIGN_RIGHT = DT_RIGHT; //

static const int ALIGN_TOP = DT_TOP; //0
static const int ALIGN_MIDDLE = DT_VCENTER; //
static const int ALIGN_BOTTOM = DT_BOTTOM; //

static const int ALIGN_MASK = ALIGN_LEFT | ALIGN_CENTER | ALIGN_RIGHT
							| ALIGN_TOP | ALIGN_MIDDLE | ALIGN_BOTTOM;

class XCell
{
public:
	XCell(void);
	~XCell(void);
	
	XCell* operator = (XCell& cell);

public:
	int rowSpan;
	int colSpan;

	CString text;
	COLORREF textColor;
	CFont* textFont;
	int textFontSize;
	CString textFontFace;


	CString label;
	COLORREF labelColor;
	CFont* labelFont;
	int labelFontSize;


	int format;
	int leftMargin;
	int rightMargin;

	int backMode;
	COLORREF backColor;

	COLORREF borderColor;
	int borderStyle;

	bool overlap;

public:
	int SetSpan(int rows, int cols);

	int SetText(CString str);
	CString GetText();
	int SetTextColor(COLORREF color);
	COLORREF GetTextColor();
	int SetTextFont(CFont* font);
	CFont* GetTextFont();
	int SetTextFontSize(int size);
	int GetTextFontSize();

	int SetLabel(CString str);
	CString GetLabel();
	int SetLabelColor(COLORREF color);
	COLORREF GetLabelColor();
	int SetLabelFont(CFont* font);
	CFont* GetLabelFont();
	int SetLabelFontSize(int size);
	int GetLabelFontSize();

	int SetFormat(int format);
	int GetFormat();

	int SetLeftMargin(int pixels);
	int GetLeftMargin();

	int SetRightMargin(int pixels);
	int GetRightMargin();

	int SetBackMode(int mode);
	int GetBackMode();

	int SetBackColor(COLORREF color);
	COLORREF GetBackColor();

	int SetBorderSyle(int syle);
	int GetBorderSyle();

	int SetOverlap (bool enable);
	bool GetOverlap ();

	int SetAlignment (int align);
	int GetAlignment ();
	int SetSingleLine (bool enable);
	bool GetSingleLine ();

	int SetWordbreak (bool enable);
	bool GetWordbreak ();

	int SetEllipsis (bool enable);
	bool GetEllipsis ();
	
	int CalcTextRect (CDC* pDC, RECT* rect);

public:
	int Draw(CDC* pDC, RECT rect);
	int DrawText(CDC* pDC, RECT rect);
	int DrawLabel(CDC* pDC, RECT rect);
	int DrawBorder(CDC* pDC, RECT rect);
	int DrawBackground (CDC* pDC, RECT rect);
	int DrawHitBorder (CDC* pDC, RECT rect, COLORREF color); 

};

⌨️ 快捷键说明

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