?? mybutton.h
字號:
/////////////////////////////////////////////////////////////////////////////
//CMyButton:圓角矩形按鈕
//
//用法:
//①在對話框中放置一個按鈕控件;
//②為按鈕定義變量,類型改為CMyButton;
//③若想重設按鈕文本顏色和背景顏色,在對話框的OnInitDialog()函數中設置。
//
//作者:風林
// 2004-12-18
////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MYBUTTON_H__351CBBC5_8129_404E_BDDD_F0C29D05104F__INCLUDED_)
#define AFX_MYBUTTON_H__351CBBC5_8129_404E_BDDD_F0C29D05104F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyButton.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyButton window
class CMyButton : public CButton
{
// Construction
public:
CMyButton();
private:
BOOL b_Flag; //按鈕狀態(false-正常,true-當前)
BOOL b_InRect; //鼠標進入標志
CString m_strText; //按鈕文字
COLORREF m_ForeColor; //文本顏色
COLORREF m_BkColor; //背景色
COLORREF m_LockForeColor; //鎖定按鈕的文字顏色
CRect m_ButRect; //按鈕尺寸
CPoint m_textPt; //文字坐標(左上角)
void NormalButton(CDC *pDC); //畫正常的按鈕
void PassButton(CDC *pDC); //畫鼠標經過時的按鈕
void LockButton(CDC *pDC); //畫鎖定的按鈕
// Attributes
public:
void SetForeColor(COLORREF color); //設置文本顏色
void SetBkColor(COLORREF color); //設置背景顏色
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyButton)
public:
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyButton();
// Generated message map functions
protected:
//{{AFX_MSG(CMyButton)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYBUTTON_H__351CBBC5_8129_404E_BDDD_F0C29D05104F__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -