方法一:参考链接
public partial class Form1 : Form
{
public Form1()
{
//var timer = new System.Threading.Timer(ShowTime, null, 0, 1000);
var timer = new System.Threading.Timer(Initial, null, 0, 0);
}
private void Initial(object x)
{
if (!this.IsHandleCreated || this.IsDisposed) return;
this.Invoke((MethodInvoker) delegate
{
//界面初始化的操作
});
}
}
方法二:参考链接
//控件较多,优化打开效率
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // 用双缓冲绘制窗口的所有子控件
return cp;
}
}