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

📄 bitmapmenu.h

📁 本程序是一个用于管理学生成绩例子.通过利用MFC的DAO类
💻 H
字号:
#include "StdAfx.h"
#ifndef __BITMAP_MENU_H__
#define __BITMAP_MENU_H__

class BMenuData
{
	public:
		BMenuData();
		char menuText[32];
		int menuIconNormal;
		int menuIconSelected;
		int menuIconDisabled;
		UINT nID;
};

typedef enum {Normal,TextOnly} HIGHLIGHTSTYLE;

class CBitmapMenu : public CMenu	// Derived from CMenu
{
	public:
		CBitmapMenu(CImageList* pList = NULL); 
		virtual ~CBitmapMenu();

	protected:
		CTypedPtrArray<CPtrArray, BMenuData*>	m_MenuList;	// Stores list of menu items 
		// When loading an owner-drawn menu using a Resource, CBitmapMenu must keep track of
		// the popup menu's that it creates. Warning, this list *MUST* be destroyed
		// last item first :)

		CTypedPtrArray<CPtrArray, CBitmapMenu*>	m_SubMenus;	// Stores list of sub-menus 

	public:
		virtual void DrawItem(LPDRAWITEMSTRUCT);		// Draw an item
		virtual void MeasureItem(LPMEASUREITEMSTRUCT);	// Measure an item

		void SetTextColor (COLORREF );	// Set the text color
		void SetBackColor (COLORREF);	// Set background color
		void SetHighlightColor (COLORREF);	// Set highlight Color
		void SetHighlightStyle (HIGHLIGHTSTYLE );	// Set Highlight style
		void SetHighlightTextColor (COLORREF);	// Set Highlight text color
		void SetImageList(CImageList* pList);


		BOOL AppendMenu(UINT nFlags, UINT nID = 0,
						LPCTSTR lpstrText = NULL, 
						int nIconNormal = -1,
						int nIconSelected = -1,
						int nIconDisabled = -1);	// Owner-Drawn Append 

		BOOL ModifyODMenu(LPCTSTR lpstrText,
							UINT nID = 0,
							int nIconNormal = -1,
							int nIconSelected = -1,
							int nIconDisabled = -1);	// Owner-Drawn Modify 

		virtual BOOL LoadMenu(LPCTSTR lpszResourceName);	// Load a menu
		virtual BOOL LoadMenu(int nResource);	// ... 

		virtual BOOL DestroyMenu();

	protected:
		COLORREF m_clrBack;
		COLORREF m_clrText;
		COLORREF m_clrHilight;
		COLORREF m_clrHilightText;

		LOGFONT m_lf;
		CFont m_fontMenu;

		UINT m_iMenuHeight;
		BOOL m_bLBtnDown;

		CImageList*	m_pList;

		UINT	m_nIconX;
		UINT	m_nIconY;

		CBrush m_brBackground,m_brSelect;
		CPen m_penBack;
		HIGHLIGHTSTYLE m_hilightStyle; 
};

#endif //__BITMAP_MENU_H__

⌨️ 快捷键说明

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