动态创建菜单
来源:互联网 发布:网络推广广告语 编辑:程序博客网 时间:2024/05/05 19:39
void CMyF1Dlg::OnContextMenu(CWnd* pWnd , CPoint point ){ if (point.x == -1 && point.y == -1) { CRect rect; GetClientRect(rect); ClientToScreen(rect); point = rect.TopLeft(); point.Offset(5, 5); } CMenu subMenu; subMenu.CreatePopupMenu();//创建一个子菜单 subMenu.InsertMenu( 0, MF_BYPOSITION, 4444, _T("E") ); //给子菜单添加项 subMenu.InsertMenu( 0, MF_BYPOSITION, 5555 ,_T("F") ); subMenu.InsertMenu( 0, MF_BYPOSITION, 6666 ,_T("G") ); subMenu.InsertMenu( 0, MF_BYPOSITION, 7777 ,_T("H") ); CMenu pMenu; pMenu.CreatePopupMenu(); //创建一个主菜单 pMenu.AppendMenu( MF_STRING, 1111, _T("A") ); //给主菜单添加三个基本相 pMenu.AppendMenu( MF_STRING, 2222, _T("B") ); pMenu.AppendMenu( MF_STRING, 3333, _T("C") ); pMenu.AppendMenu( MF_POPUP,( UINT_PTR )subMenu.m_hMenu,_T( "M") ); //添加一个带弹出菜单的项 CWnd* pWndPopupOwner = this; while ( pWndPopupOwner->GetStyle() & WS_CHILD ) pWndPopupOwner = pWndPopupOwner->GetParent(); pMenu.TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner );}
- 如何动态创建菜单
- 动态菜单的创建
- Delphi动态创建菜单
- 动态创建菜单
- 动态创建菜单
- C#动态创建菜单
- 动态创建Menu 菜单
- MFC动态创建菜单
- 动态创建菜单
- 动态创建菜单
- C#动态创建菜单
- 动态创建菜单
- 动态创建级联菜单
- 动态创建级联菜单
- VC 动态创建菜单
- MFC动态创建菜单
- delphi创建动态菜单
- MFC动态创建菜单
- HashMap 和 Hashtable 的区别和联系
- J2EE学习笔记
- 按钮特效
- 60个超实用的生活小常识!
- 系统程序员成长计划-并发(三)(上)
- 动态创建菜单
- 学了几个月vc++,只会看些简单的程序,自己还是不会编写,很是郁闷呀
- English Articles
- VB编程动态注册ActiveX控件
- Your Life
- 注册和反注册的菜单项
- IE 0DAY ms08-78 漏洞
- 全国14亿人口,每人给你一块钱,你会做什么
- 关于Win32 API的RedrawWindow函数和InvalidateRect函数