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

📄 myvariousstate.h

📁 电梯调度模拟,有mfc界面展现5部电梯的相互调度
💻 H
字号:
#pragma once



//枚举电梯的状态和电梯的方向
enum state {Ele_IDLE,Ele_DOWN_RUN,Ele_UP_RUN,Ele_DOWN_PAUSE,Ele_UP_PAUSE,Ele_DOOR_OPEN,MAL_FUNCTION,BAD_STATE};
enum direction {DOWN,UP,BAD_DIRE};


#define MAX_ELEVATOR_NUM 5			//电梯(箱体)数
#define MAX_FLOOR_NUM 20		//楼层数
#define MAX_PASSENGER_NUM 18//电梯允许的最大乘客数
#define RUNONE_FLOOR_TIME 1	//电梯运行一个楼层所需时间
#define DOOR_KEEPOPEN_TIME 5	//保持开门状态的时间
#define BAD_REQUEST_TIME 120	//等待队列中超过多长时间没有得到处理的请求将被删除
#define WAIT_INTERVAL 1	//处理等待队列的时间间隔
#define ELEVATOR_HEIGHT 31	//电梯箱体高度

#define DIST_PRIO 3			//计算优先数时距离所占权重
#define WEIGHT_PRIO 1		//计算优先数时载重量所占权重

//发往父窗体的消息
#define WM_ARRIVE_ONEFLOOR		WM_USER+ 0X80






//控件
class   MyButton   :   public   CButton   
{   
	//   Construction   
public:   
	MyButton();   

	//   Attributes   
protected:   
	//按钮的外边框   
	CPen   m_BoundryPen;   

	//鼠标指针置于按钮之上时按钮的内边框   
	CPen   m_InsideBoundryPenLeft;   
	CPen   m_InsideBoundryPenRight;   
	CPen   m_InsideBoundryPenTop;   
	CPen   m_InsideBoundryPenBottom;   

	//按钮获得焦点时按钮的内边框   
	CPen   m_InsideBoundryPenLeftSel;   
	CPen   m_InsideBoundryPenRightSel;   
	CPen   m_InsideBoundryPenTopSel;   
	CPen   m_InsideBoundryPenBottomSel;   

	//按钮的底色,包括有效和无效两种状态   
	CBrush   m_FillActive;   
	CBrush   m_FillInactive;   

	//按钮的状态   
	BOOL   m_bOver; //鼠标位于按钮之上时该值为true,反之为flase   
	BOOL   m_bTracking; //在鼠标按下没有释放时该值为true   
	BOOL   m_bSelected; //按钮被按下是该值为true   
	BOOL   m_bFocus; //按钮为当前焦点所在时该值为true   
public:   

protected:   
	virtual   void   PreSubclassWindow();   
	//}}AFX_VIRTUAL   

	//   Implementation   
public:   
	virtual   void   DrawInsideBorder(CDC   *pDC,   CRect*   rect);   
	virtual   void   DoGradientFill(CDC   *pDC,   CRect*   rect);   
	virtual   void   DrawItem(LPDRAWITEMSTRUCT   lpDrawItemStruct);   
	virtual   ~MyButton();   

	//   Generated   message   map   functions   
protected:   
	//{{AFX_MSG(MyButton)   
	afx_msg   void   OnMouseMove(UINT   nFlags,   CPoint   point);   
	afx_msg   LRESULT   OnMouseLeave(WPARAM   wParam,   LPARAM   lParam);   
	afx_msg   LRESULT   OnMouseHover(WPARAM   wParam,   LPARAM   lParam);   
	afx_msg   BOOL   OnEraseBkgnd(CDC*   pDC);   
	//}}AFX_MSG   

	DECLARE_MESSAGE_MAP()   
};   


///////////////////////////////////
class CColorStaticST : public CStatic
{
public:
	CColorStaticST();
	enum {	ST_FLS_SLOW,
		ST_FLS_NORMAL,
		ST_FLS_FAST};


public:
	virtual ~CColorStaticST();

	void SetTextColor(COLORREF crTextColor = 0xffffffff);
	COLORREF GetTextColor();

	void SetBkColor(COLORREF crBkColor = 0xffffffff);
	COLORREF GetBkColor();

	void SetBlinkTextColors(COLORREF crBlinkTextColor1, COLORREF crBlinkTextColor2);
	void StartTextBlink(BOOL bStart = TRUE, UINT nElapse = ST_FLS_NORMAL);

	void SetBlinkBkColors(COLORREF crBlinkBkColor1, COLORREF crBlinkBkColor2);
	void StartBkBlink(BOOL bStart = TRUE, UINT nElapse = ST_FLS_NORMAL);

	void EnableNotify(CWnd* pParent = NULL, UINT nMsg = WM_USER);


protected:
	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnDestroy();

	DECLARE_MESSAGE_MAP()
private:
	UINT m_nTimerId;

	COLORREF m_crTextColor;
	COLORREF m_crBlinkTextColors[2];
	BOOL m_bTextBlink;
	int m_nTextBlinkStep;

	COLORREF m_crBkColor;
	COLORREF m_crBlinkBkColors[2];
	BOOL m_bBkBlink;
	int m_nBkBlinkStep;

	CBrush m_brBkgnd;
	CBrush m_brBlinkBkgnd[2];

	CWnd* m_pParent;
	UINT m_nMsg;
};

⌨️ 快捷键说明

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