窗体设计器生成的代码 private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.PictureBox pictureBox9;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.PictureBox pictureBox10;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.PictureBox pictureBox11;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.PictureBox pictureBox12;
private System.Windows.Forms.PictureBox pictureBox13;
private System.Windows.Forms.PictureBox pictureBox14;
private System.Windows.Forms.PictureBox pictureBox15;
private System.Windows.Forms.PictureBox pictureBox16;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.PictureBox pictureBox17;
private System.Windows.Forms.PictureBox pictureBox18;
private System.Windows.Forms.PictureBox pictureBox19;
private System.Windows.Forms.PictureBox pictureBox20;
private System.Windows.Forms.PictureBox pictureBox21;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.PictureBox pictureBox22;
private System.Windows.Forms.PictureBox pictureBox23;
private System.Windows.Forms.PictureBox pictureBox24;
private System.Windows.Forms.PictureBox pictureBox25;
private System.Windows.Forms.PictureBox pictureBox26;
private System.Windows.Forms.Label label1;
示例控件的详情设计情况 //
// label6
//
this.label6.AutoSize = true;
this.label6.BackColor = System.Drawing.Color.Transparent;
this.label6.Cursor = System.Windows.Forms.Cursors.Hand;
this.label6.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
this.label6.ForeColor = System.Drawing.Color.White;
this.label6.Location = new System.Drawing.Point(66, 167);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(76, 18);
this.label6.TabIndex = 2;
this.label6.Text = "御 湾";
this.label6.Click += new System.EventHandler(this.label6_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage")));
this.pictureBox1.Location = new System.Drawing.Point(47, 170);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(13, 13);
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;界面上有这些控件,运行后发现要加载5秒钟才能把全部控件显示出来,
请问有什么办法能提高下加载速度吗?
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.PictureBox pictureBox9;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.PictureBox pictureBox10;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.PictureBox pictureBox11;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.PictureBox pictureBox12;
private System.Windows.Forms.PictureBox pictureBox13;
private System.Windows.Forms.PictureBox pictureBox14;
private System.Windows.Forms.PictureBox pictureBox15;
private System.Windows.Forms.PictureBox pictureBox16;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.PictureBox pictureBox17;
private System.Windows.Forms.PictureBox pictureBox18;
private System.Windows.Forms.PictureBox pictureBox19;
private System.Windows.Forms.PictureBox pictureBox20;
private System.Windows.Forms.PictureBox pictureBox21;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.PictureBox pictureBox22;
private System.Windows.Forms.PictureBox pictureBox23;
private System.Windows.Forms.PictureBox pictureBox24;
private System.Windows.Forms.PictureBox pictureBox25;
private System.Windows.Forms.PictureBox pictureBox26;
private System.Windows.Forms.Label label1;
示例控件的详情设计情况 //
// label6
//
this.label6.AutoSize = true;
this.label6.BackColor = System.Drawing.Color.Transparent;
this.label6.Cursor = System.Windows.Forms.Cursors.Hand;
this.label6.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold);
this.label6.ForeColor = System.Drawing.Color.White;
this.label6.Location = new System.Drawing.Point(66, 167);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(76, 18);
this.label6.TabIndex = 2;
this.label6.Text = "御 湾";
this.label6.Click += new System.EventHandler(this.label6_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage")));
this.pictureBox1.Location = new System.Drawing.Point(47, 170);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(13, 13);
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;界面上有这些控件,运行后发现要加载5秒钟才能把全部控件显示出来,
请问有什么办法能提高下加载速度吗?
如果达不到你的要求,就不要使用dotnet了,
这本来就是他的弱项。
纯粹是界面的控件加载问题,不设计数据读取
因为这些数据是直接写死,赋值给lable的
如果是读图片导致的慢(把所有的读图片的动作去掉,再试试,就能确认),可以“事先把图片读到内存中”来解决。
方法2 把这个窗体单例 (单例后就不要close了,只 show和 hide)
是图片加载太慢 有三十来个图片要加载,图片路径是固定的 不是读取数据库的
那么就是说要
如果图片加载慢,就在窗体构造同时,使用单独线程加载图片到内存, 然后再调用invoke方式加载图片,
public Form1()
{
//在这里 执行 加载图片到内存么?单独开个线程么?
InitializeComponent();//这个就是构造窗体
}