📄 magiclabel.h
字号:
/*
* Copyright (c) 2002, Bcdliang
* All rights reserved.
*
* 文件名称:MagicLabel.h
* 摘 要:类CMagicLabel的声明
*
* 当前版本:1.0
* 作 者:LIANG Zheng
* 完成日期:2002年7月2日
*/
#if !defined(AFX_MAGICLABEL_H__419F3229_FD5D_483D_A39D_3FC5242CE445__INCLUDED_)
#define AFX_MAGICLABEL_H__419F3229_FD5D_483D_A39D_3FC5242CE445__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//Magic效果
const UINT ML_NONE = 0; //None
const UINT ML_HSCROLLLEFT = 1; //左滚动(完全消失才重现)
const UINT ML_HSCROLLRIGHT = 2; //右滚动(完全消失才重现)
const UINT ML_HSCROLLBOTH = 3; //左右来回滚动
const UINT ML_HSCROLLAUTO = 4; //左滚动(还剩1/3就重现)
const UINT ML_STYLENUM = 5; //Magic效果数(包括None)
const UINT ML_TA_LEFT = 0x0001; //Text Align: Left
const UINT ML_TA_RIGHT = 0x0002; //Text Align: Right
const UINT ML_TA_CENTER = 0x0003; //Text Align: Center
const UINT ML_TA_TOP = 0x0010; //Text Align: Top
const UINT ML_TA_BOTTOM = 0x0020; //Text Align: Bottom
const UINT ML_TA_VCENTER = 0x0030; //Text Align: Vertical Center
/////////////////////////////////////////////////////////////////////////////
// CMagicLabel window
class CMagicLabel : public CStatic
{
// Construction
public:
CMagicLabel();
virtual ~CMagicLabel(void);
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMagicLabel)
protected:
//}}AFX_VIRTUAL
// Implementation
public:
void Initialize(); // 初始化数据成员
// 设置步长
void SetStep(UINT uStep);
// 查询步长
UINT GetStep(void) const;
// 设置速度
void SetTick(UINT uTick);
// 查询速度
UINT GetTick(void) const;
// 设置文字对齐方式
void SetTextAlign(UINT nStyle);
// 查询文字对齐方式
UINT GetTextAlign(void) const;
// 重写父类成员SetWindowText
void SetWindowText(LPCTSTR lpszString);
// 重写父类成员GetWindowText
void GetWindowText( CString& rString ) const;
// 设置MAGIC效果
void SetMagicStyle(UINT nStyle);
// 查询MAGIC效果
UINT GetMagicStyle(void) const;
// 设置字体
void SetFont(const CFont &f);
// 查询字体
CFont *GetFont(void);
// 设置背景色
void SetBkColor(COLORREF crColor);
// 查询背景色
COLORREF GetBkColor(void) const;
// 设置文字颜色
void SetTextColor(COLORREF crColor);
// 查询文字颜色
COLORREF GetTextColor() const;
// Generated message map functions
protected:
UINT m_uStep; //步长:4(1-10)
UINT m_uTick; //速度:200(50-2000)
void DrawText(void); // 重画bitmap
void CalculateTextSize(void); // 计算字符串的w,h
CDC m_MemDC; // 内存设备环境
UINT m_uMagicStyle; // 当前效果
UINT m_TextAlign; // 当前对齐方式
CString m_Text; // 当前字符串
CFont m_Font; // 当前字体
int m_TextWidth, // 字符串的宽度
m_TextHeight; // 字符串的高度
COLORREF m_BkColor, // 背景色
m_TextColor; // 前景色
CRect m_Rect; // 用户区矩形
CBitmap m_Bmp; // 位图
int m_x, m_y; // 当前绘图位置
int m_BBx, m_BBy, // BitBlt()的参数
m_BBWidth, m_BBHeight,
m_BBxScr, m_BByScr;
bool m_Left, // 是否正在向左移动
m_Top; // 是否正在向上移动
//{{AFX_MSG(CMagicLabel)
afx_msg void OnPaint();
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAGICLABEL_H__419F3229_FD5D_483D_A39D_3FC5242CE445__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -