取消鼠标按下 [英] Cancel Mouse Down

查看:79
本文介绍了取消鼠标按下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将按钮点击/双击事件限制为仅从左侧按钮触发
。如何消除

中键和右键点击?我能够捕获这些

,但我只是不确定如何取消活动....


thx

I want to restrict a buttons click/doubleclick event to
firing from the left button only. How do I eliminate the
middle and right button clicks? I am able to trap these
but I''m just not sure how to cancel the event....

thx

推荐答案

" Kurt" < KS ******* @ comcast.net> schrieb
"Kurt" <ks*******@comcast.net> schrieb
我想限制一个按钮点击/双击事件,只从左侧按钮开始。如何消除中/右键单击?我能够捕获这些
但我不知道如何取消活动....
I want to restrict a buttons click/doubleclick event to
firing from the left button only. How do I eliminate the
middle and right button clicks? I am able to trap these
but I''m just not sure how to cancel the event....




你无法取消活动,但你可以忽略它。

-

Armin



You can not cancel an event, but you can ignore it.
--
Armin


-----原始信息-----
Kurt < KS ******* @ comcast.net> schrieb
-----Original Message-----
"Kurt" <ks*******@comcast.net> schrieb
我想限制按钮单击/双击事件
仅从左侧按钮开始。如何通过中键和右键点击消除
?我能够捕获
这些,但我只是不确定如何取消活动....
I want to restrict a buttons click/doubleclick event to firing from the left button only. How do I eliminate the middle and right button clicks? I am able to trap these but I''m just not sure how to cancel the event....



你无法取消活动,但你可以忽略它。

-
Armin



You can not cancel an event, but you can ignore it.
--
Armin

.



原谅这个术语......那我怎么做到这一点?

以下内容允许我捕获事件。我需要做什么才能让我的应用程序忽略它?


Private Sub Flatbutton3_MouseDown(ByVal sender As Object,

ByVal e As System.Windows.Forms.MouseEventArgs)句柄

Flatbutton3.MouseDown


Dim eventString As String = Nothing

选择Case e.Button

Case MouseButtons.Right

eventString =" R"

Case MouseButtons.Middle

eventString =" M"

结束选择

如果eventString =" R"或者eventString =" M"然后


结束如果


End Sub


Pardon the terminology... So how do I accomplish this?
The following allows me to trap the event. What do I
need to do to have my app ignore it?

Private Sub Flatbutton3_MouseDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
Flatbutton3.MouseDown

Dim eventString As String = Nothing
Select Case e.Button
Case MouseButtons.Right
eventString = "R"
Case MouseButtons.Middle
eventString = "M"
End Select
If eventString = "R" Or eventString = "M" Then

End If

End Sub


嗨Kurt,

你需要这样的东西:


私有MouseButtonDown作为MouseButtons


Sub MouseDown()

MouseButtonDown = e.Button


Sub MouseClick()和MouseDblClick()

如果MouseButtonDown<> MouseButtons.Left

返回


Sub MouseUp()

MouseButtonDown = MouseButtons.None


问候,

Fergus
Hi Kurt,

You need something along these lines:

Private MouseButtonDown As MouseButtons

Sub MouseDown()
MouseButtonDown = e.Button

Sub MouseClick() and MouseDblClick()
If MouseButtonDown <> MouseButtons.Left
Return

Sub MouseUp()
MouseButtonDown = MouseButtons.None

Regards,
Fergus


这篇关于取消鼠标按下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆