有关右键菜单添加菜单项的操作
2010-06-08 20:06
344 查看
var //m:tmenuitem ;//使用变量只能添加一个菜单项 p: tpoint ; begin self.PopupMenu1.Items.Clear; //添加子菜单 self.PopupMenu1.Items.Add(tMenuItem.Create(self)); self.PopupMenu1.Items[self.PopupMenu1.Items.Count-1].Caption := '123' ; self.PopupMenu1.Items[self.PopupMenu1.Items.Count-1].OnClick := amenuclick ; //aMenuClick是一个预先定义好的菜单动作事件。 self.PopupMenu1.Items.Add(tMenuItem.Create(self)); self.PopupMenu1.Items[self.PopupMenu1.Items.Count-1].Caption := '456' ; self.PopupMenu1.Items[self.PopupMenu1.Items.Count-1].OnClick := amenuclick ; //定义显示的位置 p.x := self.SpeedButton8.Left ; p.y := self.SpeedButton8.Top + self.SpeedButton8.Height -1 ; P:=self.SpeedButton8.Parent.ClientToScreen(p) ; //显示菜单 self.PopupMenu1.Popup(p.X,p.Y); end;
相关文章推荐
- 我创建了一个托盘图标,可以正常使用,点击右键打开菜单。问题是如果点击右键后不选择其中一个菜单项进行操作的话,它就总不消失。
- <译> SharePoint2010 Feature功能开发——为SharePoint的ECB菜单(列表项或文档的操作菜单项)添加自定义菜单栏项目
- MFC中的CMenu---如何动态添加菜单/菜单项、子菜单、右键菜单 .
- 如何在IE右键菜单中添加菜单项
- 如何动态添加菜单/菜单项、子菜单、右键菜单
- c++怎样给文件右键菜单添加一项!给桌面文件右键添加菜单项
- JCEF 如何修改右键菜单项(JCEF在右键菜单中添加开发者选项-show dev tools)
- 如何在IE右键菜单中添加菜单项以及如何添加IE任务栏按钮
- SharePoint2010 Feature功能开发——为SharePoint的ECB菜单(列表项或文档的操作菜单项)添加自定义菜单栏项目
- 动态添加菜单项、子菜单、右键菜单
- VSTO 为Office已有右键菜单添加自己的菜单项(word,Excel)
- [转]SharePoint2010 Feature功能开发——为SharePoint的ECB菜单(列表项或文档的操作菜单项)添加自定义菜单栏项目
- 动态添加菜单项、子菜单、右键菜单
- 修改注册表在特定文件右键菜单中添加菜单项
- 如何动态添加菜单/菜单项、子菜单、右键菜单
- 如何动态添加菜单/菜单项、子菜单、右键菜单
- 动态添加菜单项、子菜单、右键菜单
- 动态添加菜单/菜单项、子菜单、右键菜单
- MFC中的CMenu---如何动态添加菜单/菜单项、子菜单、右键菜单
- JCEF 如何修改右键菜单项(JCEF在右键菜单中添加开发者选项-show dev tools)