popupmenu的问题
时间:2011-11-05
来源:互联网
做一个数据库软件有很多image控件 在image上点右键弹出popupmenu菜单 菜单里有打开选项 image显示打开的图片
问题是多个image控件可以用一个popupmenu控件吗 代码要怎么写 谢谢
问题是多个image控件可以用一个popupmenu控件吗 代码要怎么写 谢谢
作者: jige5d 发布时间: 2011-11-05
多个控件可以用1个popupmenu的,将它们的popupmenu属性全指向同一popupmenu就可以了
而响应PopupMenu时,PopupMenu的PopupComponent属性就是你点击的那个控件
下面是delphi6自带的EX,两个Edit同时用一个PopupMenu
Delphi(Pascal) code
而响应PopupMenu时,PopupMenu的PopupComponent属性就是你点击的那个控件
下面是delphi6自带的EX,两个Edit同时用一个PopupMenu
Delphi(Pascal) code
procedure TForm1.FormCreate(Sender: TObject); begin PopupMenu1.AutoPopup := True; Edit1.PopupMenu := PopupMenu1; Edit2.PopupMenu := PopupMenu1; end; These are the cut, copy, and paste OnClick events for the commands on the pop-up menu. procedure TForm1.Copy1Click(Sender: TObject); begin if PopupMenu1.PopupComponent = Edit1 then Edit1.CopyToClipboard elseif PopupMenu1.PopupComponent = Edit2 then Edit2.CopyToClipboard else Beep; end; procedure TForm1.Cut1Click(Sender: TObject); begin if PopupMenu1.PopupComponent = Edit1 then Edit1.CutToClipboard elseif PopupMenu1.PopupComponent = Edit2 then Edit2.CutToClipboard; else Beep; end; procedure TForm1.Paste1Click(Sender: TObject); begin if PopupMenu1.PopupComponent = Edit1 then Edit1.PasteFromClipboard else if PopupMenu1.PopupComponent = Edit2 then Edit2.PasteFromClipboard; else Beep; end;
作者: keiy 发布时间: 2011-11-05
谢谢~~~~~~~~~~~~~~~~~~~~~~~
作者: jige5d 发布时间: 2011-11-05
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28