110,550
社区成员
发帖
与我相关
我的任务
分享
Form2 f2 = new Form2();
f2.Show();
Thread.Sleep(5000);
f2.Close();
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Action action = () => Thread.Sleep(5 * 1000);
action.BeginInvoke(delegate { this.BeginInvoke(new Action(this.Close)); }, null);
}
}
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
Thread.Sleep(5000);
this.Close();
}