Replacement for multiple inheritance
-
Hello, I'm developing a set of Windows form controls that should extend the functionalities of the following classes: public class MyPushButton : System.Windows.Forms.Button public class MyCheckbox : System.Windows.Forms.CheckBox public class MyRadioButton : System.Windows.Forms.RadioButton I decided to derive a class from each of these base classes in order to get the right notifications from the base class events. Now these custom controls should apply some graphic effect to the buttons through a set of properties that would be common to all of the "MyXXX" button classes: due to the fact that multiple inheritance is not supported in C#, how can I avoid to have all of the properties and their get/set helpers duplicated in each of the "MyXXX" classes? Thanks in advance and Kind regards Seve
-
Hello, I'm developing a set of Windows form controls that should extend the functionalities of the following classes: public class MyPushButton : System.Windows.Forms.Button public class MyCheckbox : System.Windows.Forms.CheckBox public class MyRadioButton : System.Windows.Forms.RadioButton I decided to derive a class from each of these base classes in order to get the right notifications from the base class events. Now these custom controls should apply some graphic effect to the buttons through a set of properties that would be common to all of the "MyXXX" button classes: due to the fact that multiple inheritance is not supported in C#, how can I avoid to have all of the properties and their get/set helpers duplicated in each of the "MyXXX" classes? Thanks in advance and Kind regards Seve
What you need to be looking at, for controls at least, is Property Extenders: MSDN: Windows Forms Extender Provider Sample[^] MSDN: Implementing an Extender Provider[^] CodeProject: Control Extender Library[^] This should hopefully give you enough information to get you underway. --Colin Mackay--