📄 menubutton.h
字号:
#if !defined(AFX_MENUBUTTON_H__79EBA469_04EE_49F9_A641_CB616F9C5C1E__INCLUDED_)
#define AFX_MENUBUTTON_H__79EBA469_04EE_49F9_A641_CB616F9C5C1E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Return values
#ifndef BTNST_OK
#define BTNST_OK 0
#endif
// MenuButton.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMenuButton window
class CMenuButton : public CButton
{
// Construction
public:
CMenuButton();
// Attributes
public:
BOOL bSetMenu;
// Operations
public:
// void SetBtnBitmap(HBITMAP bitmap);
//给按钮设置图片
//分别对应按钮的正常、按钮捕捉焦点后鼠标弹起与按下的三种状态
//目前三种位图都必须要设置,以后再考虑完善
void SetBtnBitmap(UINT nBitmapResources,UINT nBitmapResourcesUp,UINT nBitmapResourceDown);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMenuButton)
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMenuButton();
private:
//代表鼠标按键的状态
//0--正常;1--UP;2--down;3--move;4--disable
int nState;
CMenu m_Menu;
UINT m_nMenuSourceId;
//按钮所对应的菜单项的ID
INT m_nClickFlag;
BOOL m_Selected;//是否处于选中状态
BOOL bMouse;//鼠标是否处于控件的范围内
BOOL m_bMouseOnButton; // Is mouse over the button?
BOOL b_ClickFlag; //单击选择区
HDC m_hHdc;
HMENU m_hMenu;
protected:
// all bitmaps must be the same size
HBITMAP m_hbitmap; // normal image (REQUIRED)
HBITMAP m_hbitmapUp; // mouse up (OPTIONAL)
HBITMAP m_hbitmapDown; // mouse down
// Generated message map functions
protected:
//{{AFX_MSG(CMenuButton)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnClicked();
//}}AFX_MSG
virtual void PreSubclassWindow();
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MENUBUTTON_H__79EBA469_04EE_49F9_A641_CB616F9C5C1E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -