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

📄 index152.htm

📁 一本不错的VC编程的参考书
💻 HTM
字号:
<html>
<style type="text/css"><!--
.p9 {  font-family: "宋体"; font-size: 9pt}a        {text-transform: none; text-decoration: none;}
a:hover {text-decoration: underline; color: #FF0000;}
--></style>
<body background="../di2001.jpg">
<h3 align="center"><font COLOR="#AOAO99"></font></h3>
<table width="100%" border="1" cellspacing="1">
<tr><td><p align="center"><font color="#FF0000">如何激活变灰的弹出菜单?</font></td></tr>
<tr><td><p>
</Br>
在设计菜单时设定为GRAYED的菜单项,如何在运行时激活它?<Br>
</Br>
请看下面的示例代码:<Br>
</Br>
void CMyView::OnRButtonDown(UINT nFlags, CPoint point)<Br>
{<Br>
&nbsp;CScrollView::OnRButtonDown(nFlags, point);<Br>
</Br>
&nbsp;CMenu *menu, *popup;<Br>
&nbsp;menu = new CMenu();<Br>
</Br>
&nbsp;// load menu from resource file<Br>
&nbsp;menu->LoadMenu( IDR_POPUPMENU );<Br>
&nbsp;popup = menu->GetSubMenu(0);  // item 0 is DUMMY<Br>
</Br>
&nbsp;UINT nEnable;<Br>
&nbsp;nEnable = MF_BYCOMMAND|MF_GRAYED;<Br>
</Br>
&nbsp;if( your test )<Br>
&nbsp;{<Br>
&nbsp;&nbsp;nEnable = MF_BYCOMMAND|MF_ENABLED;<Br>
&nbsp;}<Br>
</Br>
&nbsp;popup->EnableMenuItem( ID_YOUR_ID, nEnable );<Br>
</Br>
&nbsp;//display menu<Br>
&nbsp;ClientToScreen(&point);<Br>
&nbsp;popup->TrackPopupMenu(<Br>
&nbsp;&nbsp;&nbsp;TPM_LEFTALIGN | TPM_RIGHTBUTTON,<Br>
&nbsp;&nbsp;&nbsp;point.x, point.y, this );<Br>
&nbsp;delete menu;<Br>
}<Br>
</Br>
</Br>
</p></td></tr>
</table>
</body></html>

⌨️ 快捷键说明

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