DigiDisplay.h
上传用户:cbxyz2008
上传日期:2007-01-02
资源大小:45k
文件大小:4k
- /////////////////////////////////////////////////////////////////////////////
- // Copyright (C) 1998 by Michel Wassink
- // All rights reserved
- //
- // This is free software.
- // You may redistribute it by any means providing it is not sold for profit
- // without the author written consent.
- //
- // No warrantee of any kind, expressed or implied, is included with this
- // software; use at your own risk, responsibility for damages (if any) to
- // anyone resulting from the use of this software rests entirely with the
- // user.
- //
- // Basic idea from J鰎g K鰊ig of the completely free tetris clone "CGTetris".
- // Clock stuff from by Xie Jingwei.
- //
- // Send bug reports, bug fixes, enhancements, requests, flames, etc., and
- // I'll try to keep a version up to date. I can be reached as follows:
- // mww@mitutoyo.nl (company site)
- // mwassink@csi.com (private site)
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_CDigiDisplay_H__84DF3FA2_067D_11D2_9AA5_0060B0CDC13E__INCLUDED_)
- #define AFX_CDigiDisplay_H__84DF3FA2_067D_11D2_9AA5_0060B0CDC13E__INCLUDED_
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- // CDigiDisplay.h : header file
- //
- #include "RGBCOLOR.H"
- #define MAXSEGCHARS 40
- #define TOTCHARS (MAXSEGCHARS+2)
- /////////////////////////////////////////////////////////////////////////////
- // CDigiDisplay window
- class CDigiDisplay : public CStatic
- {
- // Construction
- public:
- CDigiDisplay();
- // Attributes
- public:
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CDigiDisplay)
- //}}AFX_VIRTUAL
- // Implementation
- public:
- void SetText(LPCSTR lpszFormat);
- COLORREF GetColor() const { return m_OnColor;}
- void SetColor(COLORREF OffColor, COLORREF OnColor);
- void SetBackColor(COLORREF BackColor = BLACK);
- virtual ~CDigiDisplay();
- // Generated message map functions
- protected:
- //{{AFX_MSG(CDigiDisplay)
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg void OnPaint();
- //}}AFX_MSG
- void UpdateColor();
- HBITMAP LoadBitMap(int iBmp);
- int GetDigit(TCHAR cChar);
- CString m_strNumber;
- DECLARE_MESSAGE_MAP()
- private:
- CString m_strFormat;
- CString m_strOldNumber;
- BITMAP m_BM[TOTCHARS];
- COLORREF m_OffColor;
- COLORREF m_OnColor;
- COLORREF m_BackColor;
- };
- void DDX_DigiDisplay(CDataExchange* pDX, int nIDC, LPCTSTR lpszFormat, ... );
- class CDigiClock : public CDigiDisplay
- {
- // Construction
- public:
- CDigiClock();
- // Attributes
- public:
- enum CClockStyle { XDC_SECOND, XDC_NOSECOND };
- // Operations
- public:
- CClockStyle GetStyle() const { return m_style;}
- CClockStyle SetStyle(CClockStyle style);
- BOOL GetAlarm() const { return m_bAlarm;}
- BOOL SetAlarm(BOOL bAlarm = TRUE);
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CDigiClock)
- protected:
- virtual void PreSubclassWindow();
- //}}AFX_VIRTUAL
- // Implementation
- public:
- // Generated message map functions
- protected:
- //{{AFX_MSG(CDigiClock)
- afx_msg void OnTimer(UINT nIDEvent);
- afx_msg void OnDestroy();
- //}}AFX_MSG
- private:
- BOOL m_bAlarm;
- CClockStyle m_style;
- UINT m_nTimer;
- UINT m_nCount;
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_CDigiDisplay_H__84DF3FA2_067D_11D2_9AA5_0060B0CDC13E__INCLUDED_)