c# 打开界面时加快打开速度

方法一:参考链接

		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;
            }
        }
发布了44 篇原创文章 · 获赞 4 · 访问量 7954

猜你喜欢

转载自blog.csdn.net/fangyu723/article/details/105698922