⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buttonst.h

📁 是本人编写的串行通信的程序
💻 H
字号:
#if !defined(AFX_BUTTONST_H__9BEB8AEB_F91A_45DE_A8FB_1781D12822A0__INCLUDED_)
#define AFX_BUTTONST_H__9BEB8AEB_F91A_45DE_A8FB_1781D12822A0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ButtonST.h : header file
//
//#define ST_LIKEIE
//#define ST_USE_MEMDC
/////////////////////////////////////////////////////////////////////////////
// CButtonST window

class CButtonST : public CButton
{
// Construction
public:
	CButtonST();
    enum{ST_ALIGN_HORIZ,ST_ALIGN_VERT};
// Attributes
public:
	HICON m_hIconIn;
	HICON m_hIconOut;
// Operations
public:
int m_nAlign;
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CButtonST)
	public:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual void PreSubclassWindow();
	virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL


// Implementation
public:
	virtual ~CButtonST();

	// Generated message map functions
protected:
	//{{AFX_MSG(CButtonST)
	afx_msg void OnCaptureChanged(CWnd *pWnd);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
public:
    BOOL GetDefault();
	void SetTooltipText(CString *spText,BOOL bActivate=TRUE);
	void ActivateTooltip(BOOL bEnable=TRUE);
	void SetFlatFocus(BOOL bDrawFlatFocus,BOOL bRepaint=FALSE);
	BOOL GetFlatFocus();
	void SetDefaultActiveFgColor(BOOL bRepaint=TRUE);
	void SetActiveFgColor(COLORREF crNew,BOOL bRepaint=FALSE);
	const COLORREF GetActiveFgColor();
	void SetDefaultActiveBgColor(BOOL bRepaint=TRUE);
    void SetActiveBgColor(COLORREF crNew,BOOL bRepaint=FALSE);
    const COLORREF GetActiveBgColor();
	void SetDefaultInactiveFgColor(BOOL bRepaint=TRUE);
    void SetInactiveFgColor(COLORREF crNew,BOOL bRepaint=FALSE);
	const COLORREF GetInactiveFgColor();
	void SetDefaultInactiveBgColor(BOOL bRepaint=TRUE);
    void SetInactiveBgColor(COLORREF crNew,BOOL bRepaint=FALSE);
    const COLORREF GetInactiveBgColor();
	void SetShowText(BOOL bShow=TRUE);
	BOOL GetShowText();
	void SetAlign(int nAlign);
	int GetAlign();
	void SetFlat(BOOL bState=TRUE);
	BOOL GetFlat();
	void DrawBorder(BOOL bEnable=TRUE);
	void SetIcon(UINT nIconInId,UINT nIconOutId);
private:
	void DrawTheIcon(CDC *pDC,CString *title,RECT *rcItem,CRect *captionRect,BOOL IsPressed,BOOL IsDisable);
	void InitToolTip();
	
	BOOL m_bShowText;
	BOOL m_bDrawBorder;
	BOOL m_bIsFlat;
	BOOL m_MouseOnButton;
	BOOL m_bDrawFlatFocus;
	BOOL m_bIsDefault;
//	BOOL bIsDisabled;
	CToolTipCtrl m_ToolTip;

	BYTE m_cyIcon;
	BYTE m_cxIcon;
	CDC m_dcBK;
	CBitmap m_bmpBk;
//	CBitmap *m_pbmpOldBk;
	BOOL m_bDrawTransparent;
	BOOL m_IsDefault;
	COLORREF m_crInactiveBg;
	COLORREF m_crInactiveFg;
	COLORREF m_crActiveBg;
	COLORREF m_crActiveFg;

};

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

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

#endif // !defined(AFX_BUTTONST_H__9BEB8AEB_F91A_45DE_A8FB_1781D12822A0__INCLUDED_)

⌨️ 快捷键说明

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