using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Threading;//引用線程的命名空間 namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Thread th = new Thread(new ThreadStart(aa)); th.Start(); } //建立委託 private delegate void SetBut(); void aa() { SetBut sb = new SetBut(weituo); this.Invoke(sb); } void weituo() { button1.Text = "成功了"; } } }