社区
.NET技术其他语言
帖子详情
MenuItem 类的Select 事件和Click 事件有什么区别?
mengshui
2003-09-04 09:06:44
rt
...全文
170
6
打赏
收藏
MenuItem 类的Select 事件和Click 事件有什么区别?
rt
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
chengfh
2003-09-09
打赏
举报
回复
click event
Occurs when the menu item is clicked or selected using a shortcut key or access key defined for the menu item.
select event
Occurs when the user places the cursor over a menu item.
mengshui
2003-09-09
打赏
举报
回复
up
alexy
2003-09-08
打赏
举报
回复
只有设置为可以选择的菜单项(就是我们在菜单中看到前面带一个勾的那种)才有select事件。
zhulb
2003-09-07
打赏
举报
回复
click event
Occurs when the menu item is clicked or selected using a shortcut key or access key defined for the menu item.
select event
Occurs when the user places the cursor over a menu item.
you can see the difference
ATField
2003-09-04
打赏
举报
回复
你点一下就是先选择(Select)再Click
Select指的就是菜单被选择(这时还没有点击呢)
比如鼠标在菜单上面移动(或者按方向键),菜单的颜色改变,这个就是选择(Select)
Select event occurs when the user places the cursor over a menu item
thp
2003-09-04
打赏
举报
回复
Select是状态,Click是动作
Flex自定义右键菜单
Flex自定义右键菜单
wpf实现的checkbox层级联动树形菜单
实现右键(展开所有、关闭所有、选择所有、反选所有) 实现选中上级时自动选择下级所有
记事本 用b.net
Private Sub AxWindowsMediaPlayer1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Public Class Form1 Private Sub 文件ToolStrip
MenuItem
_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub
MenuItem
15_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditCopy.
Click
rtBook.Copy() End Sub Private Sub
MenuItem
16_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditPaste.
Click
rtBook.Paste() '粘贴操作 End Sub Private Sub rtBook_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rtBook.TextChanged fsave = False '控件中的内容发生变化时,该标志为False End Sub Dim fsave As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '为全局变量赋值 '对保存文件对话框赋初值 SaveFileDialog1.FileName = "" SaveFileDialog1.DefaultExt = "txt" SaveFileDialog1.Filter = "Text File(*.txt)|*.txt|All files(*.*)|*.*" SaveFileDialog1.Title = "保存" '对打开文件对话框赋初值 OpenFileDialog1.FileName = "" OpenFileDialog1.DefaultExt = "txt" OpenFileDialog1.Filter = "Text File(*.txt)|*.txt|All files(*.*)|*.*" OpenFileDialog1.Title = "打开" End Sub Private Sub
MenuItem
5_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileNew.
Click
Dim num1 As Integer '如果文本已被保存,则清空rtBook内容,重置变量新建文本 If fsave Then rtBook.Clear() SaveFileDialog1.FileName = "" '文件如果还没有保存,则询问用户如何处理 Else num1 = MsgBox("文件的内容已被改变。想保存文件吗?", vbYesNoCancel + 48, "记事本")
Select
Case num1 '用户选择保存,而且该文件从未保存过,则执行保存文件的操作 Case 6 If SaveFileDialog1.FileName = "" Then If SaveFileDialog1.ShowDialog Then rtBook.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If '如果该文件已存在,则弹出对话框,要求用户回答后再保存 End If '清空RTbook的内容,重置变量新建文本 fsave = True rtBook.Clear() SaveFileDialog1.FileName = "" Case 7 '如果用户选择不保存,则立即清空RTbook的内容,新建文本 rtBook.Clear() SaveFileDialog1.FileName = "" fsave = True Case Else '用户选择取消操作,则什么也不做,取消这次的新建操作 End
Select
End If End Sub Private Sub
MenuItem
6_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.
Click
Dim num1 As Integer '如果文件内容还未保存,则弹出对话框,询问用户如何处理 If Not fsave Then num1 = MsgBox("文件的内容已被改变。想要保存文件吗?", vbYesNoCancel + 48, "记事本")
Select
Case num1 Case 6 '用户选择保存操作,而且该文件从未保存过,则输入文件名后进行保存 If SaveFileDialog1.FileName = "" Then If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If Else '若该文件已存在,则弹出对话框,用户选择保存后,直接保存 rtBook.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If '弹出【打开】对话框,执行打开文件的操作 fsave = True If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.LoadFile(OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If Case 7 '用户选择不保存文件,则直接打开文本文件 If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.LoadFile(OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText) fsave = True End If Case Else '用户选择了取消操作 End
Select
Else '文本已被保存,直接打开文件进行操作 If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.LoadFile(OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If fsave = True End If End Sub Private Sub
MenuItem
8_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileSave.
Click
If SaveFileDialog1.FileName = "" Then '如果文件从未保存过,则弹出对话框,输入文件名后,直接保存 If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If Else '若该文件以保存过,则弹出对话框后,用户选择保存后,直接保存到原文件中 rtBook.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText) End If fsave = True End Sub Private Sub
MenuItem
9_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileSaveAs.
Click
'现将保存对话框的标题改为“另存为” SaveFileDialog1.Title = "另存为" If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText) fsave = True End If '文件保存完成后,对话框标题再改为“另存” SaveFileDialog1.Title = "保存" End Sub Private Sub
MenuItem
11_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.
Click
Close() End Sub Private Sub
MenuItem
12_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditUndo.
Click
rtBook.Undo() '用户撤消操作 End Sub Private Sub
MenuItem
14_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditCut.
Click
rtBook.Cut() '剪切操作 End Sub Private Sub
MenuItem
19_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEdit
Select
All.
Click
rtBook.
Select
All() '全选操作 End Sub Private Sub
MenuItem
17_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditDelete.
Click
rtBook.Cut() End Sub Private Sub
MenuItem
20_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFont.
Click
If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.Font = FontDialog1.Font '用户选择字体 End If End Sub Private Sub
MenuItem
21_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuBackcolor.
Click
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.ForeColor = ColorDialog1.Color '选择文本的颜色 End If End Sub Private Sub
MenuItem
22_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuForeColor.
Click
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then rtBook.BackColor = ColorDialog1.Color '选择文本框的背景颜色 End If End Sub Private Sub
MenuItem
23_
Click
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelpAbout.
Click
Dim 关于记事本 As Integer 关于记事本 = MsgBox("我的记事本 版本:1.0 版权所有(李振,吕红飞) 2004 http://www.hbsi.com.cn") End Sub
winform 部分空间的应用
这些控件的应用以后你用得着,treew节点的增删改,包括快捷菜单方式的操作
ContextMenu(wpf)
WPF 以Textbox为例,进行ContextMenu的一些动作,比较简单易懂 右键菜单,文本框
.NET技术其他语言
1,977
社区成员
12,447
社区内容
发帖
与我相关
我的任务
.NET技术其他语言
.NET技术 其他语言讨论
复制链接
扫一扫
分享
社区描述
.NET技术 其他语言讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章