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

📄 navbutton.h

📁 EVC环境下用SDK开发WINCE的应用程序
💻 H
字号:
// NavButton.h: interface for the NavButton class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_NAVBUTTON_H__E1A56145_61CE_493F_9554_EF936EF6B558__INCLUDED_)
#define AFX_NAVBUTTON_H__E1A56145_61CE_493F_9554_EF936EF6B558__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "NButton.h"

#define ICONMARGIN 5	// The left margin of the icon on the button
#define TEXTLEFTMARGIN 5	// The left margin of the text when Left_Align
#define TEXTRIGHTMARGIN 5	// The right margin of the text when Right_Align

#define TEXTCOLOR_WHITE  RGB(255,255,255)
#define TEXTCOLOR_BLACK  RGB(0,0,0)
static const int BS_KINDS = 15;
typedef enum
{
	BS_NORMAL		= 0,
	BS_ANGLE		= 1
}	EU_BS_STYLE;

typedef enum
{
	BK_STD_MENU		= 0,
	BK_STD_OPER,
	BK_LITTLE_OPER, 
	BK_RADIO  , 
	BK_CHECK
}	EU_BK_STYLE;

typedef enum 
{
	DISABLED = 0,
	PRESSED,
	CHECKED,
	NORMAL
} EU_BT_STATUS;

class CNavButton : public CNButton  
{
public:
// Construction&destruction
	CNavButton();
	virtual ~CNavButton();

// Overridable functions
	virtual void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
//	virtual BOOL OnEraseBkgnd(HDC hdc);

// Attributes
	// Set the button background style
	void SetBkStyle(EU_BK_STYLE euBkStyle) { m_euBkStyle = euBkStyle; }
	void SetChecked(BOOL bChecked=TRUE)	{ m_bChecked = bChecked; }
	BOOL IsChecked() { return m_bChecked; }
	BOOL SetIcon(WORD wIconCode, WORD wIconCodeDisable = 0);
	void SetIconAlignStyle(UINT uStyle) {m_uIconFormat = uStyle;}
    void SetIconCode(WORD usIconCode){m_usIconCode = usIconCode;}
	void SetTransBlt(BOOL bTransBlt) { m_bTransBlt = bTransBlt; }

protected:
	BOOL	m_bChecked;	// Current value for checkbox
	HICON	m_hIcon;
	HICON	m_hIconDisable;
	EU_BS_STYLE m_euButtonStyle;
	EU_BK_STYLE m_euBkStyle;
    WORD	m_usIconCode;
	// determine how to draw the icon.
	// 0 -- draw the icon on the top of the button.(default value)
	// 1 -- draw the icon on the left of the button.
	UINT	m_uIconFormat;

	BOOL m_bPressed;
	BOOL m_bVisible; 
	BOOL m_bEnable;
//	BOOL m_bFrozen;

	// when background of the dialog is filled with the overlay,
	// blt the button's bitmap entirly including the key color  
	// on the angles, it will be override by overlay.
	// otherwise we only blt the effective part of the bmp(excluding
	// key color) by calling TransparentBlt(). its performance is 
	// lower than BitBlt().
	// set this member to FALSE in default.
	BOOL m_bTransBlt;

	// Helper functions
	HBITMAP	LoadBkBitmap(BOOL bEnabled, BOOL bPressed, BOOL bChecked);
	void	GetIconSize(DWORD &dwWidth, DWORD &dwHeight);
	BOOL	IsIconButton() { return (0xFFFF != m_usIconCode || 0 != m_hIcon) ;}
	// calculate the coordinates where the icon will be drawn.
	void GetIconPos(int *px, int *py);
	void GetTextPos(RECT *prc);

};

#endif // !defined(AFX_NAVBUTTON_H__E1A56145_61CE_493F_9554_EF936EF6B558__INCLUDED_)

⌨️ 快捷键说明

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