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

📄 lamparray.h

📁 郎顿51开发板上位机代码 帮助你快速开发工控程序
💻 H
字号:
/////////////////////////////////////////////////////////
//			灯阵列LampArray封装类
//	版本:1.03
//	最后修改日期:2002.1.25
/////////////////////////////////////////////////////////

#if !defined(AFX_LAMPARRAY_H__29728184_5512_456F_9578_85E559EE6400__INCLUDED_)
#define AFX_LAMPARRAY_H__29728184_5512_456F_9578_85E559EE6400__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LampArray.h : header file
//

//下面的宏定义了灯阵列的当前状态
#define LA_TEST		0	//仪表的自检状态,信号灯自动变化
#define LA_WORK		1	//仪表的工作状态,由外部信号控制灯的变化
#define LA_SHUTDOWN	2	//仪表的关闭状态,不作任何动作 

//下面的宏定义了灯的形状样式
#define LA_ELLIPSE		0	//椭圆灯(可以通过指定相等的长轴和短轴来使它成圆形)
#define LA_RECTANGLE	1	//矩形灯

/////////////////////////////////////////////////////////////////////////////
// LampArray window

class LampArray : public CStatic
{
// Construction
public:
	LampArray(CWnd * parent);

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(LampArray)
	//}}AFX_VIRTUAL

// Implementation
public:
	void DrawFace(void);
	void LA_SetSubText(UINT rows, UINT columns, CString text);
	void LA_SetSubText(UINT offset, CString text);
	CString LA_GetSubText(UINT rows, UINT columns);
	CString LA_GetSubText(UINT offset);
	void LA_InverseLampStatus(UINT rows, UINT columns);
	void LA_InverseAllLampStatus(void);
	void LA_InverseLampStatus(UINT offset);
	void LA_TurnOffAllLamp(void);
	void LA_TurnOnAllLamp(void);
	void LA_SetLampSpace(UINT x_space, UINT y_space);
	void LA_SetLampBdWidth(UINT width);
	void LA_SetLampPos(int x, int y);
	void LA_SetText(CString text);
	void LA_SetBorderColor(COLORREF ligthcolor, COLORREF darkcolor);
	void LA_SetBorderWidth(UINT width);
	void LA_SetLampLightColor(COLORREF color);
	void LA_SetLampDarkColor(COLORREF color);
	void LA_SetTextColor(COLORREF color);
	void LA_SetTextOffset(int x, int y);
	void LA_SetBorderStyle(UINT left, UINT top, UINT right, UINT bottom);
	void LA_SetLampStyle(UINT style);
	void LA_SetLampSize(UINT width, UINT height);
	void LA_SetSize(UINT width, UINT height);
	void LA_SetArraySize(UINT rows, UINT columns);
	void LA_SetFontSize(UINT size);
	void LA_SetBkColor(COLORREF color);
	void LA_SetStatus(UINT status);
	int LA_GetLampStatus(UINT rows, UINT columns);
	int LA_GetLampStatus(UINT offset);
	void LA_SetLampStatus(UINT offset, UINT status);
	void LA_SetLampStatus(UINT rows, UINT columns, UINT status);
	void LA_MoveWindow(int x, int y);
	virtual ~LampArray();

	// Generated message map functions
protected:
	//{{AFX_MSG(LampArray)
	afx_msg void OnPaint();
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
private:
	UINT LA_Height;			//仪表的高度
	UINT LA_Width;			//仪表的宽度
	UINT LA_Status;			//仪表的状态
	UINT LA_Columns;		//灯阵列的列数目
	UINT LA_Rows;			//灯阵列的行数目
	COLORREF LA_BkColor;	//仪表的背景颜色
	
	UINT LA_FontSize;		//文字字体的大小
	COLORREF LA_TextColor;	//文字的颜色
	CFont LA_Font;			//文字的字体
	CString LA_Text;		//灯对应的文字,各灯的文字用“,”分隔开
	CPoint LA_TextOffset;	//各灯对应的文字和灯的左上角的相对位置坐标

	int * LA_LampStatus;		//灯的状态数组(1表示点亮,0表示熄灭)
	UINT LA_LampStyle;			//灯的样式(矩形或者椭圆)
	UINT LA_LampBdWidth;		//灯的边界宽度(只对矩形的灯有效)
	UINT LA_LampYSpace;			//灯在Y方向的间距
	UINT LA_LampXSpace;			//灯在X方向的间距
	UINT LA_LampHeight;			//灯的高度(对于椭圆灯则为椭圆轴)
	UINT LA_LampWidth;			//灯的宽度(对于椭圆灯则为椭圆轴)
	CPoint LA_LampPos;			//第一个灯的位置(相对于仪表左上角)
	COLORREF LA_LampLightColor;	//灯的点亮状态颜色
	COLORREF LA_LampDarkColor;	//灯的熄灭状态颜色
	
	UINT LA_BorderTop;			//标志顶部边界是否绘制
	UINT LA_BorderBottom;		//标志底部边界是否绘制
	UINT LA_BorderLeft;			//标志左边界是否绘制
	UINT LA_BorderRight;		//标志右边界是否绘制
	UINT LA_BorderWidth;		//仪表边界的宽度
	COLORREF LA_BdLightColor;	//仪表边界的亮部颜色
	COLORREF LA_BdDarkColor;	//仪表的3D边界暗部颜色


	COLORREF GetNextColor(COLORREF current_color, int delta);
	COLORREF GetNextColor(COLORREF color, double ratio);
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_LAMPARRAY_H__29728184_5512_456F_9578_85E559EE6400__INCLUDED_)

⌨️ 快捷键说明

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