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

📄 popupmenu.h

📁 使用Socket和多线程技术实现远程通信
💻 H
字号:
// PopupMenu.h: interface for the CPopupMenu class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_POPUPMENU_H__F2CEE8B2_014D_11D2_83E4_0000B43382FE__INCLUDED_)
#define AFX_POPUPMENU_H__F2CEE8B2_014D_11D2_83E4_0000B43382FE__INCLUDED_

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

class CPopupMenu : public CMenu  
{
public:
	void Display(CPoint point,  CWnd* pParentWnd);
	void Enable(UINT nID,BOOL bEnable);
	CPopupMenu();
	virtual ~CPopupMenu();

	void Load(UINT nID);
	BOOL LoadToolBarResource(UINT resId);
	void RemapMenu(CMenu* pMenu);

protected:
	void Init();
	BOOL m_bFirstRun;
	CWordArray m_arrayItemState;
	void ConvertMenu(CMenu* pSourceMenu,CMenu* pDestMenu);
	struct ToolBarData	
	{
		// 工具栏资源结构
		WORD wVersion;
		WORD wWidth;			
		WORD wHeight;			
		WORD wItemCount;		
	};
    //每个菜单项的数据
	struct SpawnItem
	{
		int		iImageIdx;
		int		iCmd;
		TCHAR   cText[128];
	};
	//图像数据
	struct ImageItem
	{
		int	iImageIdx;
		int	iCmd;
	};


    //按钮字体,黑体
	HFONT hMenuBoldFont;
	BOOL CreateBoldFont();

	HFONT	hMenuFont, hGuiFont;

	CSize szImage;  //图像尺寸
	int FindImageItem(const int cmd);

	SpawnItem* AddSpawnItem(const TCHAR* txt, const int cmd);
	void AddImageItem(const int idx, WORD cmd);


	CImageList ilList;
	CImageList ilOther;

	//菜单各种状态颜色
	COLORREF crMenuText, crMenuTextSel;
	COLORREF cr3dFace, crMenu, crHighlight, cr3dHilight, cr3dShadow, crGrayText;
	COLORREF m_clrBtnFace, m_clrBtnHilight, m_clrBtnShadow;

	int iSpawnItem;
	SpawnItem** pSpawnItem;

	int iImageItem;
	ImageItem* pImageItem;
    
	//装入工具栏资源
	BOOL AddToolBarResource(UINT resId);
    //改变菜单项目状态
	void EnableMenuItems(CMenu* pMenu, CWnd* pParent);

	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);

private:
	BOOL DrawCheckmark(CDC& dc, const CRect& rc, BOOL bSelected);
};

#endif // !defined(AFX_POPUPMENU_H__F2CEE8B2_014D_11D2_83E4_0000B43382FE__INCLUDED_)

⌨️ 快捷键说明

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