
响应对应窗体的 或控件的MouseClick事件,以下是捕获代码:
if (eButton == SystemWindowsFormsMouseButtonsMiddle)
{
}
# <Button-1>:鼠标左击事件
# <Button-2>:鼠标中击事件
# <Button-3>:鼠标右击事件
# <Double-Button-1>:双击事件
# <Triple-Button-1>:三击事件
from tkinter import
tk = Tk()
canvas = Canvas(width=500,height=500)
canvaspack()
#canvascreate_polygon(0,0,250,250,fill = 'red')
def echo_event(evt):
#打印键盘事件
if evttype == "2":
print("键盘:%s" % evtkeysym)
#打印鼠标 *** 作
if evttype == "4":
print("鼠标: %s" % evtnum)
#
print(evttype)
#键盘事件
canvasbind_all("<KeyPress>",echo_event)
#如果绑定指定的键盘,则"<Key>" 或者"<KeyPress>"都可以,具体到指定键的话后面加入下划线和指定的键就好了,如:绑定小写字母t和Left键
canvasbind_all("<KeyPress-t>",echo_event)
canvasbind_all("<KeyPress-Left>",echo_event)
#鼠标事件
canvasbind_all("<Double-Button-1>",echo_event)
canvasbind_all("<Button-1>",echo_event)
canvasbind_all("<Button-2>",echo_event)
canvasbind_all("<Button-3>",echo_event)
Point p;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
p = new Point(eX, eY); //按下
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
p = new Point(eX, eY); //松开
}
以上就是关于c#中如何判断鼠标中键(滚轮)按下全部的内容,包括:c#中如何判断鼠标中键(滚轮)按下、python怎么判断鼠标按下、c# 如何记录鼠标按下和松开这两个事件的鼠标位置等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)