📄 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 button1Delay
{
public partial class Form1 : Form
{
public delegate void 我的委托();//声明一个委托
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
new System.Threading.Thread(new System.Threading.ThreadStart(新线程)).Start();//创建一个新的线程并启动
}
public void 设置文字()
{
button1.Text = "Hello";
}
public void 新线程()
{
System.Threading.Thread.Sleep(2000);//线程休眠2秒
button1.BeginInvoke(new 我的委托(设置文字));//在button1所在线程上执行“设置文字”
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -