Visual inheritance

  • Thread starter Thread starter epederiva
  • Start date Start date
E

epederiva

Hi,
i have a base control MyButton inherit from System.Windows.Forms.Button
and i want to use it in all my application, this control set some properties
like Font, FlatStyle etc from a configuration file. I put this control in a
control library, then create a driver (test) project. In test project i add
a new form, and then from Toolbox "My user controls" a drag MyButton over
the new form. It works all perfectly.
But if i change a property of MyButtun (base class) (ex. ForeColor or
BackColor or Font), etc... from my configuration file, the childButton
(inherit from MyButton) doesn't change.
It is due to "Windows Form Designer" that in InitializeComponent, when i
drag the chil control over the form, add some code and set properties.
Is there any solotion for this problem?
How implement visual inheritance corretly?

Thanks in advance,
sorry for my english.

epederiva
 
Hi,

You should close and re-open the form being designed to reflect the changes.
If you make changes to the code of MyButton (base class), you should close
the form being designed, rebuild the project it is contained in, and then
re-open the form in the designer.
 
Back
Top