版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、/ 红色指示条的定义ColorStaticST.h#ifndef _COLORSTATICST_H#define _COLORSTATICST_H#if _MSC_VER >= 1000#pragma once#endif / _MSC_VER >= 1000/ ColorStaticST.h : header file/class CColorStaticST : public CStatic/ Construction public:CColorStaticST();enum ST_FLS_SLOW,ST_FLS_NORMAL,ST_FLS_FAST;/ Attributes
2、public:/ Operations public:/ Overrides/ ClassWizard generated virtual function overrides/ Implementationpublic:virtual CColorStaticST();void SetTextColor(COLORREF crTextColor = 0xffffffff);COLORREF GetTextColor();void SetBkColor(COLORREF crBkColor = 0xffffffff);COLORREF GetBkColor();void SetBlinkTex
3、tColors(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*
4、 pParent = NULL, UINT nMsg = WM_USER);static const short GetVersionI();static const char* GetVersionC();/ Generated message map functions 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_nTim
5、erId;COLORREF m_crTextColor;COLORREF m_crBlinkTextColors2;BOOL m_bTextBlink;int m_nTextBlinkStep;COLORREF m_crBkColor;COLORREF m_crBlinkBkColors2;BOOL m_bBkBlink;int m_nBkBlinkStep;CBrush m_brBkgnd;CBrush m_brBlinkBkgnd2;CWnd* m_pParent;UINT m_nMsg;#endif/ 红色指示条的实现 ColorStaticST.cpp/ ColorStaticST.c
6、pp : implementation file#include "stdafx.h"#include "ColorStaticST.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ 电梯停止及运行时所在楼层颜色条状态显示/ 构造函数和析构函数CColorStaticST:CColorStaticST()/ Set default parent window and notification message m_pParen
7、t = NULL;m_nMsg = WM_USER;/ By default the control is not blinkingm_bTextBlink = FALSE;m_nTextBlinkStep = 0;m_bBkBlink = FALSE;m_nBkBlinkStep = 0;m_nTimerId = 0;/ Set default foreground textm_crTextColor = :GetSysColor(COLOR_BTNTEXT);/ Set default foreground text (when blinking) m_crBlinkTextColors0
8、 = m_crTextColor; m_crBlinkTextColors1 = m_crTextColor;/ Set default background textm_crBkColor = :GetSysColor(COLOR_BTNFACE);/ Set default background text (when blinking) m_crBlinkBkColors0 = m_crBkColor; m_crBlinkBkColors1 = m_crBkColor;/ Set default background brushm_brBkgnd.CreateSolidBrush(m_cr
9、BkColor);/ Set default background brush (when blinking)m_brBlinkBkgnd0.CreateSolidBrush(m_crBkColor);m_brBlinkBkgnd1.CreateSolidBrush(m_crBkColor); / End of CColorStaticSTCColorStaticST:CColorStaticST() / End of CColorStaticSTBEGIN_MESSAGE_MAP(CColorStaticST, CStatic)ON_WM_CTLCOLOR_REFLECT()ON_WM_TI
10、MER()ON_WM_DESTROY()END_MESSAGE_MAP()/ 颜色条标示消息响应HBRUSH CColorStaticST:CtlColor(CDC* pDC, UINT nCtlColor)/ Set foreground color/ If control is blinking (text) if (m_bTextBlink = TRUE)pDC->SetTextColor(m_crBlinkTextColorsm_nTextBlinkStep);elsepDC->SetTextColor(m_crTextColor);/ Set background col
11、or & brush/ If control is blinking (background)if (m_bBkBlink = TRUE)pDC->SetBkColor(m_crBlinkBkColorsm_nBkBlinkStep);return (HBRUSH)m_brBlinkBkgndm_nBkBlinkStep;/ If control is not blinking (background) pDC->SetBkColor(m_crBkColor);/ Return a non-NULL brush if the parent's handler sho
12、uld not be called return (HBRUSH)m_brBkgnd; / End of CtlColorvoid CColorStaticST:OnDestroy()CStatic:OnDestroy();/ Destroy timer (if any)if (m_nTimerId > 0) KillTimer(m_nTimerId);/ Destroy resourcesm_brBkgnd.DeleteObject();m_brBlinkBkgnd0.DeleteObject();m_brBlinkBkgnd1.DeleteObject(); / End of OnD
13、estroyvoid CColorStaticST:SetTextColor(COLORREF crTextColor)/ Set new foreground colorif (crTextColor != 0xffffffff)m_crTextColor = crTextColor;else / Set default foreground colorm_crTextColor = :GetSysColor(COLOR_BTNTEXT);/ Repaint controlInvalidate(); / End of SetTextColorCOLORREF CColorStaticST:G
14、etTextColor()return m_crTextColor; / End of GetTextColorvoid CColorStaticST:SetBkColor(COLORREF crBkColor)/ Set new background color if (crBkColor != 0xffffffff)m_crBkColor = crBkColor;else / Set default background colorm_crBkColor = :GetSysColor(COLOR_BTNFACE);m_brBkgnd.DeleteObject();m_brBkgnd.Cre
15、ateSolidBrush(m_crBkColor);/ Repaint control Invalidate(); / End of SetBkColorCOLORREF CColorStaticST:GetBkColor()return m_crBkColor; / End of GetBkColorvoid CColorStaticST:SetBlinkTextColors(COLORREF crBlinkTextColor1, crBlinkTextColor2)/ Set new blink text colorsm_crBlinkTextColors0 = crBlinkTextC
16、olor1;m_crBlinkTextColors1 = crBlinkTextColor2; / End of SetBlinkTextColorsvoid CColorStaticST:StartTextBlink(BOOL bStart, UINT nElapse)UINT nCount;/ Destroy any previous timer if (m_nTimerId > 0)KillTimer(m_nTimerId);m_nTimerId = 0;m_bTextBlink = bStart;m_nTextBlinkStep = 0;/ Start timerif (m_bT
17、extBlink = TRUE)COLORREFswitch (nElapse)case ST_FLS_SLOW:nCount = 2000;break;case ST_FLS_NORMAL:nCount = 1000;break;case ST_FLS_FAST:nCount = 500;break;default:nCount = nElapse;break;m_nTimerId = SetTimer(1, nCount, NULL); / End of StartTextBlinkvoid CColorStaticST:SetBlinkBkColors(COLORREF crBlinkB
18、kColor1, COLORREF crBlinkBkColor2) / Set new blink background colorsm_crBlinkBkColors0 = crBlinkBkColor1;m_crBlinkBkColors1 = crBlinkBkColor2;m_brBlinkBkgnd0.DeleteObject();m_brBlinkBkgnd0.CreateSolidBrush(m_crBlinkBkColors0);m_brBlinkBkgnd1.DeleteObject();m_brBlinkBkgnd1.CreateSolidBrush(m_crBlinkB
19、kColors1);/ Repaint control Invalidate(); / End of SetBlinkBkColorvoid CColorStaticST:StartBkBlink(BOOL bStart, UINT nElapse)UINT nCount;/ Destroy any previous timer if (m_nTimerId > 0)KillTimer(m_nTimerId);m_nTimerId = 0;m_bBkBlink = bStart;m_nBkBlinkStep = 0;/ Start timerif (m_bBkBlink = TRUE)s
20、witch (nElapse)case ST_FLS_SLOW:nCount = 2000;break;case ST_FLS_NORMAL:nCount = 1000;break;case ST_FLS_FAST:nCount = 500;break;default:nCount = nElapse;break;m_nTimerId = SetTimer(1, nCount, NULL); / End of StartBkBlinkvoid CColorStaticST:EnableNotify(CWnd* pParent, UINT nMsg)m_pParent = pParent;m_nMsg = nMsg; / End of EnableNotifyconst short CColorStaticST:GetVersionI()return 10; / Divide by 10 to get actual version / End of GetVersionIconst char* CColorStaticST:GetVersionC()return "1.0" / End
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 IEC 62004:2007 EN Thermal-resistant aluminium alloy wire for overhead line conductor
- 【正版授权】 IEC 61883-6:2014 EN-FR Consumer audio/video equipment - Digital interface - Part 6: Audio and music data transmission protocol
- 【正版授权】 IEC 61837-2:2011 EN-FR Surface mounted piezoelectric devices for frequency control and selection - Standard outlines and terminal lead connections - Part 2: Ceramic enclosur
- 【正版授权】 IEC 61753-021-3:2012 EN-FR Fibre optic interconnecting devices and passive components - Performance standard - Part 021-3: Single-mode fibre optic connectors for category U
- 【正版授权】 IEC 61558-2-23-EXV-RLV:2024 EN Safety of transformers,reactors,power supply units and combinations thereof - Part 2-23: Particular requirements and tests for transformers
- 【正版授权】 IEC 61466-1:1997 EN-FR Composite string insulator units for overhead lines with a nominal voltage greater than 1000 V - Part 1: Standard strength classes and end fittings
- 【正版授权】 IEC 61439-1:2011 EN-FR Low-voltage switchgear and controlgear assemblies - Part 1: General rules
- 【正版授权】 IEC 61391-2:2010 EN-FR Ultrasonics - Pulse-echo scanners - Part 2: Measurement of maximum depth of penetration and local dynamic range
- 【正版授权】 IEC 61331-2:2014 EN-FR Protective devices against diagnostic medical X-radiation - Part 2: Translucent protective plates
- 【正版授权】 IEC 61300-2-55:2017 EN Fibre optic interconnecting devices and passive components - Basic test and measurement procedures - Part 2-55: Tests - Strength of mounted adaptor
- 2022-2023学年湖南省永州市江永县湘少版(三起)四年级下册期末质量检测英语试卷(无答案)
- 【核心素养目标】统编版语文七年级上册(2024)18 我的白鸽 公开课一等奖创新教案
- 2023-2024学年人教版八年级下学期期末考数学试卷附答案解析
- 体育场馆物业管理服务物资装备计划
- 北京海淀区2023-2024学年物理八下期末复习检测试题及答案解析
- 理论联系实际如何保证全面深化改革开放的正确方向?(2024春期试卷B一)
- 品牌学智慧树知到期末考试答案章节答案2024年山东女子学院
- 书法鉴赏智慧树知到期末考试答案章节答案2024年绍兴文理学院
- 乡村规划设计智慧树知到期末考试答案章节答案2024年同济大学
- MOOC 财税法学-浙江财经大学 中国大学慕课答案
- 2023年四川省绵阳市中考英语试卷真题(含答案)
评论
0/150
提交评论