如果你不想另外启动一个Thread来执行的话,那就用异步委托了,其实本质上还是用到了多线程。- public delegate void Adelegate();
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- //Control.CheckForIllegalCrossThreadCalls = false;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Adelegate dgt = new Adelegate(() => {
- MessageBox.Show("qq");
- });
- dgt.BeginInvoke(null,null);
- }
- }
- }
复制代码 |