| re: Need an alternative to multiple inheritance
Yes, you are right. I tend to think in terms of completely boxing up the
whole thing. So that if ever you decide you don't want a panel, but you want
a tab control, you just swap out the control in the user control, and
re-implement all the properties, and know that everything is still valid.
Whereas with a panel, panel specific properties may have ended up being set
directly on the consuming form.
But you are right, in most cases that wouldn't matter, and inheriting from
panel works fine.
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:%234QCan39FHA.252@TK2MSFTNGP15.phx.gbl...[color=blue]
> "Marina" <someone@nospam.com> schrieb:[color=green]
>> Create a user control.Add MyPanel to the user control, add MyRTF inside
>> the panel.
>> Create properties inside this user control to expose whatever properties
>> need to be exposed for both the textbox and the panel.
>>
>> Now you can use the user control on forms.[/color]
>
> Mhm... To do that, it's not even necessary to create a usercontrol. It's
> sufficient to create a class which inherits from panel and adds a
> richtextbox control to its 'Controls' collection. Then you can extend the
> inherited panel by additional properties.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>[/color] |