?? digitaldevice.h
字號:
/////////////////////////////////////////////////////////
// 數碼式測量設備DigitalDevice封裝類
// 版本:1.06
// 最后修改日期:2002.1.25
/////////////////////////////////////////////////////////
#if !defined(AFX_DIGITALDEVICE_H__1CFA7C26_1B47_4CCE_9D54_AC20EE425705__INCLUDED_)
#define AFX_DIGITALDEVICE_H__1CFA7C26_1B47_4CCE_9D54_AC20EE425705__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DigitalDevice.h : header file
//
//定義類中使用的字模的參數
#define FONT_MAXNUM 14 //字模中含有的字數
#define FONT_LENGTH 9 //字模中每個字的最大筆劃數目
//下面兩個宏定義了儀表的工作模式
#define DD_NUMBER 0 //要顯示的是數值
#define DD_STRING 1 //要顯示的是字符串
//下面兩個宏定義儀表的顯示模式
#define DD_LED 0 //要顯示的是LED數字儀表
#define DD_TEXT 1 //要顯示的是文字
//下面的宏定義了儀表的當前狀態
#define DD_TEST 0 //儀表的自檢狀態,數字自動變化
#define DD_WORK 1 //儀表的工作狀態,等待數值或字符串的變化
#define DD_SHUTDOWN 2 //儀表的關閉狀態,不作任何動作
/////////////////////////////////////////////////////////////////////////////
// DigitalDevice window
class DigitalDevice : public CStatic
{
// Construction
public:
DigitalDevice(CWnd *parent);
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(DigitalDevice)
//}}AFX_VIRTUAL
// Implementation
public:
void DD_SetDisMode(UINT mode);
void DD_SetBdColor(COLORREF lightcolor, COLORREF darkcolor);
void DD_SetBkColor(COLORREF color);
void DD_SetBorderWidth(UINT width);
void DD_SetBorderStyle(UINT left, UINT top, UINT right, UINT bottom);
void DD_SetBits(UINT bits);
void DD_SetTextDarkColor(COLORREF color);
void DD_SetTextLightColor(COLORREF color);
void DD_SetCurrentNumber(double num);
void DD_SetStatus(UINT status);
void DD_SetCurrentString(CString string);
void SetCurrentNumber(double num);
void DD_SetWorkMode(UINT mode);
void DD_SetTextPos(int x, int y);
void DD_SetTextStyle(UINT charwidth, UINT charheight, UINT charthick, UINT charspace);
void DD_Update(void);
void DD_SetSize(UINT width, UINT height);
void DD_MoveWindow(int x, int y);
virtual ~DigitalDevice();
// Generated message map functions
protected:
//{{AFX_MSG(DigitalDevice)
afx_msg void OnPaint();
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void DrawText();
void ShowFont(CDC *pDC, CRect rect, int XSize, int YSize, COLORREF TextColor, COLORREF BKColor, CString strVal);
UINT DD_Width; //儀表的寬度
UINT DD_Height; //儀表的高度
UINT DD_Status; //儀表的當前狀態
UINT DD_WorkMode; //儀表的工作方式(顯示數字還是字串)
UINT DD_DisMode; //儀表的顯示方式(顯示文字還是當作LED儀表)
UINT DD_Bits; //儀表的輸出位數
UINT DD_Font[FONT_MAXNUM][FONT_LENGTH]; //內部使用的字模數組
double DD_CurrentNumber; //當前要顯示的數字
COLORREF DD_BkColor; //儀表的背景顏色
CPoint DD_TextPos; //文字相對于儀表左上角的坐標
CString DD_CurrentString; //儀表當前要顯示的字串
UINT DD_BorderWidth; //邊界的寬度
UINT DD_BorderBottom; //表示是否畫底部的邊界
UINT DD_BorderRight; //表示是否畫右邊的邊界
UINT DD_BorderTop; //表示是否畫頂部的邊界
UINT DD_BorderLeft; //表示是否畫左邊的邊界
COLORREF DD_BdLightColor; //邊界的亮邊(右和下)顏色
COLORREF DD_BdDarkColor; //邊界的暗邊(左和上)顏色
UINT DD_CharWidth; //字體寬度
UINT DD_CharHeight; //字體高度
UINT DD_CharThick; //字體筆劃的粗細
UINT DD_CharSpace; //文字之間的水平距離
COLORREF DD_TextDarkColor; //字體亮顏色
COLORREF DD_TextLightColor; //字體暗顏色
void PutChar(CDC *dc, char c, int pos_x, int pos_y, COLORREF color); //在dc上的指定位置繪制指定字符
void DrawFace(void); //該函數繪制儀表的界面
double GetMaxNumber(); //該函數獲取儀表所能顯示的最大數字
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_DIGITALDEVICE_H__1CFA7C26_1B47_4CCE_9D54_AC20EE425705__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -