按住鼠标左键完成任务 [英] Hold down the left mouse button to do the task

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

问题描述

我不会说英语,但也许我可以告诉你我的问题。







 如果 按钮按下 那么 

Label1.text =鼠标点击(按住)

end if





我想了解上述代码的真相。并且当表单不活动时(最小化)



谢谢

Emre

解决方案

不简单我害怕:你需要安装全局鼠标钩来检测按钮点击。

这可能会有所帮助:使用C#处理全局鼠标和键盘挂钩 [ ^ ]


已解决

表格加载事件;

timer1.interval =10



私人子Timer1_Tick(发件人) As Object,e As EventArgs)处理Timer1.Tick

Select Case MouseButtons

Case Windows.Forms.MouseButtons.Left

MessageBox.Show( 按下左键)

Case Windows.Forms.MouseButtons.Right
MessageBox.Show(按下右键)

Case Windows.Forms.MouseButtons.Middle

MessageBox.Show(按下中键)



Case Windows.Forms.MouseButtons.Left + Windows.Forms.MouseButtons.Right

MessageBox.Show(左右按下 )

结束选择

结束子





谢谢...

I can not speak English but maybe i can tell my problem to you.



If  button held down  Then

Label1.text= Mouse Clicked(held down)

end if



I want the truth of the above code. And works When the form is not active (while minimize)

Thank You
Emre

解决方案

Not simple I'm afraid: you need to install global mouse hooks to detect the button clicks.
This may help: Processing Global Mouse and Keyboard Hooks in C#[^]


SOLVED
Form Load Event;
timer1.interval ="10"

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Select Case MouseButtons
Case Windows.Forms.MouseButtons.Left
MessageBox.Show("Left button pressed")
Case Windows.Forms.MouseButtons.Right
MessageBox.Show("Right button pressed")
Case Windows.Forms.MouseButtons.Middle
MessageBox.Show("Middle button pressed")

Case Windows.Forms.MouseButtons.Left + Windows.Forms.MouseButtons.Right
MessageBox.Show("Left & Right are pressed")
End Select
End Sub


Thanks...


这篇关于按住鼠标左键完成任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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