G
Guest
Hello All,
When creating a Windows Forms UserControl, is there any way to tell if its
container is in the midst of its InitializeComponent call, other than setting
a property?
For instance, say I have a control called SomeControl that contains some
properties Property1, Property2, ..., PropertyN. Each of these properties
may do something time consuming, like accessing a database or updating UI,
etc. The constructor may set up some default stuff.
Then, I have a test container that does something like:
private void InitializeComponent()
{
this.MySomeControl = new SomeControl();
// Initialize some other stuff
// |
//
// MyUTM
//
this.MySomeControl.BackColor = System.Drawing.SystemColors.Control;
this.MySomeControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.MySomeControl.Property1 = "SomeHostName";
this.MySomeControl.Property2 = "MyUserName";
// more properties
this.MySomeControl.PropertyN = Colors.Red;
this.MySomeControl.Location = new System.Drawing.Point(0, 0);
this.MySomeControl.Name = "SomeControl";
this.MySomeControl.Size = new System.Drawing.Size(760, 566);
this.MySomeControl.TabIndex = 8;
}
Is there any way to prevent the processing of all the properties until the
test client is done initializing? I don't want to process Property1, then
Property2, then PropertyN - instead I want to process PropertyN only.
Thanks,
pagates
When creating a Windows Forms UserControl, is there any way to tell if its
container is in the midst of its InitializeComponent call, other than setting
a property?
For instance, say I have a control called SomeControl that contains some
properties Property1, Property2, ..., PropertyN. Each of these properties
may do something time consuming, like accessing a database or updating UI,
etc. The constructor may set up some default stuff.
Then, I have a test container that does something like:
private void InitializeComponent()
{
this.MySomeControl = new SomeControl();
// Initialize some other stuff
// |
//
// MyUTM
//
this.MySomeControl.BackColor = System.Drawing.SystemColors.Control;
this.MySomeControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.MySomeControl.Property1 = "SomeHostName";
this.MySomeControl.Property2 = "MyUserName";
// more properties
this.MySomeControl.PropertyN = Colors.Red;
this.MySomeControl.Location = new System.Drawing.Point(0, 0);
this.MySomeControl.Name = "SomeControl";
this.MySomeControl.Size = new System.Drawing.Size(760, 566);
this.MySomeControl.TabIndex = 8;
}
Is there any way to prevent the processing of all the properties until the
test client is done initializing? I don't want to process Property1, then
Property2, then PropertyN - instead I want to process PropertyN only.
Thanks,
pagates