当前位置:首页 > 开发 > C# > 正文内容

C# 判断鼠标按键

C#3年前 (2022-10-23)
private void button1_MouseDown(object sender, MouseEventArgs e)
{
    switch (e.Button)
    {
case MouseButtons.Left:
    Console.WriteLine("左键");
    break;
case MouseButtons.None:
    break;
case MouseButtons.Right:
    Console.WriteLine("右键");
    break;
case MouseButtons.Middle:
    Console.WriteLine("中键");
    break;
case MouseButtons.XButton1:
    Console.WriteLine("后");
    break;
case MouseButtons.XButton2:
    Console.WriteLine("前");
    break;
default:
    break;
    }
}


转载请注明出处。

本文链接:http://pythonopen.com/?id=224

相关文章

C# 数据类型

Type ByteLenghtMinMax.NET Framework Typedefau...

C# BackgroundWorker的例子

以下是一个使用 BackgroundWorker 组件在 C# 中实现后台执行任务,同时在主线程更新...

C# Byte[]转为Bitmap

在 C# 中,可以使用System.Drawing命名空间下的相关类将byte[]类型的数据转换为B...

C# Control防闪烁

SetStyle(ControlStyles.AllPaintingInWmPaint |...

C# Graphics文本抗锯齿

g.TextRenderingHint = TextRenderingHint....

C# using与多重using

1. using 语句概述在 C# 中,using 语句主要用于确保实现了 IDisposable...