DrawMenuBar是一個計算機函式,功能是該函式重畫指定選單的選單條。
基本介紹
- 外文名:DrawMenuBar
- 套用學科:數學
- 適用領域範圍:計算機,編程,API
- 函式原型:BOOL DrawMenuBar(HWND hWnd)
如果系統創建視窗以後選單條被修改,則必須調用此函式來畫修改了的選單條。
函式原型:BOOL DrawMenuBar(HWND hWnd);
參數:
hWnd:其選單條需要被重畫的視窗的句柄。
速查:Windows NT:及以上版本;Windows:95及以上版本;Windows:2.0及以上版本;頭檔案:winuser.h;輸入庫:user32.lib。
示例:
void CMainFrame::OnCwndDeletefilemenu()
{
// This example deletes the leftmost popup menu or leftmost
// popup menu item from the application's main window.
CWnd* pMain = AfxGetMainWnd();
// The main window _can_ be NULL, so this code
// doesn't ASSERT and actually tests.
if (pMain != NULL)
{
// Get the main window's menu
CMenu* pMenu = pMain->GetMenu();
// If there is a menu and it has items, we'll
// delete the first one.
if (pMenu != NULL && pMenu->GetMenuItemCount() > 0)
{
pMenu->DeleteMenu(0, MF_BYPOSITION);
// force a redraw of the menu bar
pMain->DrawMenuBar();
}
// No need to delete pMenu because it is an MFC
// temporary object.
}
}