代码段1:打开后直接闪了一下就没了!!为什么
public partial class Form1 : Form { public Form2() { InitializeComponent(); } private Thread tr; private void button1_Click(object sender, EventArgs e) { tr = new Thread(new ThreadStart(Do)); tr.IsBackground = false; tr.Start(); } private void Do() { Form3 f = new Form3(); f.Show(); } }
代码段2:只能打开一个save ???请问是怎么回事??
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 f = new Form2(); f.Show(); Form2 f1 = new Form2(); f1.Show(); } }
public partial class Form2 : Form { public Form2() { InitializeComponent(); this.FormClosing += new FormClosingEventHandler(Form2_FormClosing); Thread td = new Thread(DO); td.Name = "from2"; td.Start(); } private void DO() { Thread.Sleep(2000); this.Invoke(new Action(() => { this.Close(); })); } void Form2_FormClosing(object sender, FormClosingEventArgs e) { System.Windows.Forms.SaveFileDialog sd = new SaveFileDialog(); sd.ShowDialog(); } }
- 3 回答
- 0 关注
- 534 浏览
添加回答
举报
0/150
提交
取消