wallclockst.h

来自「时钟程序」· C头文件 代码 · 共 100 行

H
100
字号
#ifndef _WALLCLOCKST_H_
#define _WALLCLOCKST_H_

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

/////////////////////////////////////////////////////////////////////////////
// CWallClockST window

class CWallClockST : public CStatic
{
// Construction
public:
	CWallClockST();

// Attributes
public:
	CString sDate;
// Operations
public:

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

// Implementation
public:
	void LoadColorSettings(); // Load the color settings of the clock from your PC.
	void SaveColorSettings(); // Save the color settings to your PC.
	void StopClock();         // Stops the clock.
	void StartClock();        // Restarts the clock
	void ResetDate();         // Reset the default date/time settings
	void SetDateTime(COleDateTime dt);
	                          // Sets new date/time settings for the clock

	void SetTextColor(COLORREF color);
	                          // Sets the text color of the clock
	COLORREF GetTextColor();
							// Retreives the current text color of the clock
	COLORREF GetTickColor();
							// Retreives the current tick color of the clock
	void SetTickColor(COLORREF color);
							 // Sets the tick color of the clock
	void SetDialColor(COLORREF color);
	                         // Sets the dial color of the clock
	COLORREF GetDialColor();
							// Retreives the current dial color of the clock
	COLORREF GetHandColor();
							// Retreives the current hand color of the clock
	void SetHandColor(COLORREF color);
							 // Sets the hand color of the clock
	virtual ~CWallClockST();

protected:
 	void DrawDate(CDC *pDC,CString str,int x,int y,COLORREF color);
    void DrawClockFace (CDC* pDC);
    void DrawSecondHand (CDC* pDC, int nLength, int nScale, int nDegrees,
        COLORREF clrColor);
    void DrawHand (CDC* pDC, int nLength, int nScale, int nDegrees,
        COLORREF clrColor);

	CRgn m_rgn;

	COleDateTime time;

	int m_nPrevSecond;        
    int m_nPrevMinute;
    int m_nPrevHour;
	int m_nSecond;        
    int m_nMinute;
    int m_nHour;
	COleDateTime m_PrevDate;

	// Generated message map functions
protected:
	COLORREF m_nColor;
	COLORREF m_bkClr;
	COLORREF m_dialClr;
	COLORREF m_tickClr;
	COLORREF m_textClr;
	//{{AFX_MSG(CWallClockST)
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnPaint();
	afx_msg void OnClose();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

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

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

#endif // _WALLCLOCKST_H_

⌨️ 快捷键说明

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