📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WinApp10_3鼠标事件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
/*
if (e.Button == MouseButtons.Right && e.Clicks == 2)
this.Close();*/
string str1="",str2="";
switch (e.Button) // 判断用户按下了哪个鼠标键
{
case MouseButtons.Right: str1 = "右"; break;
case MouseButtons.Left: str1 = "左"; break;
}
switch (e.Clicks) // 判断用户连续按下并释放了几次鼠标键
{
case 1: str2 = "单"; break;
case 2: str2 = "双"; break;
}
label1.Text = "您" + str2 + "击了鼠标" + str1 + "键!";
label1.Left = (this.Width - label1.Width) / 2;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -