Hi.
Assuming i have changed some properties of a control in a form sub class
in the form designer. Is there a simple way to get back all properties
of the base class?
regards and thanks,
Jan
Hi,
If the base class is well designed you can go property by property in
the property window and reset them using the right mouse button.
Also, you can go to the InitializeComponents method, search the block
where the designer assigned all the values to your control and delete the
lines, save it and when you return to the form designer all the values will
be reset.
For example, for a control named textBox1 you will find a block of code
like this:
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.SystemColors.MenuHighlight;
this.textBox1.ForeColor = System.Drawing.SystemColors.Menu;
this.textBox1.Location = new System.Drawing.Point(88, 91);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(230, 102);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "My custom text";
So, you can remove all these lines (except maybe Location and Size) and the
base values will be taken instead of your custom ones.
Do it with a lot of care and do not remove any line that adds your control
to a Controls collection like: this.Controls.Add(this.textBox1); or any
constructor code like: this.textBox1 = new System.Windows.Forms.TextBox();
Of course, save first a copy of your code to a safe place before trying
this.
> Hi.
>
[quoted text clipped - 4 lines]
> regards and thanks,
> Jan
Jan Weingärtner - 18 Jan 2006 17:16 GMT
> If the base class is well designed you can go property by property in
> the property window and reset them using the right mouse button.
> ...
Thanks, but editing every changed property and removing lines
from InitializeComponents is exactly, what i try to avoid.
best regards,
Jan