System.ComponentModel.ISupportInitialize的BeginInitI()和EndInit()
摘自MSDN:Visual Studio .NET 設計環境使用這個方法,來開始進行用於表單或為另一個元件所使用之元件的初始化。EndInit 方法會結束初始化。
使用 BeginInit 和 EndInit 方法,防止控制項在完全初始化之前被使用。
事例:
private void InitializeComponent()
{
this.qqGlassButton1 = new ControlExs.QQGlassButton();
((System.ComponentModel.ISupportInitialize)(this.qqGlassButton1)).BeginInit();
this.SuspendLayout();
//
// qqGlassButton1
//
this.qqGlassButton1.BackColor = System.Drawing.Color.Transparent;
this.qqGlassButton1.DialogResult = System.Windows.Forms.DialogResult.None;
this.qqGlassButton1.Font = new System.Drawing.Font("Microsoft YaHei", 9F);
this.qqGlassButton1.Location = new System.Drawing.Point(0, 0);
this.qqGlassButton1.Name = "qqGlassButton1";
this.qqGlassButton1.Size = new System.Drawing.Size(75, 23);
this.qqGlassButton1.TabIndex = 0;
this.qqGlassButton1.TabStop = false;
this.qqGlassButton1.Text = "qqGlassButton1";
this.qqGlassButton1.ToolTipText = null;
((System.ComponentModel.ISupportInitialize)(this.qqGlassButton1)).EndInit();
this.ResumeLayout(false);
}
}
}