readme.wzd

来自「MFC扩展编程实例」· WZD 代码 · 共 58 行

WZD
58
字号
/////////////////////////////////////////////////////////////////////
// Example files.
/////////////////////////////////////////////////////////////////////

WzdMenu.cpp -- a menu class which draws itself using the toolbar bitmap
WzdMenu.h		for its icons

/////////////////////////////////////////////////////////////////////
// Modify the Mainframe Class.
/////////////////////////////////////////////////////////////////////

// 1) embed the menu class in this class
	CWzdMenu m_menu;


// 2) and process these Mainfrm.cpp messages using the menu class's functions
void CMainFrame::OnInitMenu(CMenu* pMenu) 
{
	CMDIFrameWnd::OnInitMenu(pMenu);
	
	m_menu.InitMenu(this,pMenu,IDR_MAINFRAME,&m_wndToolBar);
	
}

void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) 
{
	CMDIFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
	
	m_menu.InitMenuPopup();

}

void CMainFrame::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) 
{
	if (!nIDCtl) m_menu.MeasureItem(lpMeasureItemStruct);
	
	CMDIFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}

void CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	if (!nIDCtl) m_menu.DrawItem(lpDrawItemStruct);
	
	CMDIFrameWnd::OnDrawItem(nIDCtl, lpDrawItemStruct);
}

LRESULT CMainFrame::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu) 
{
	return m_menu.MenuChar(nChar);
}


/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1999 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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