all groups > dotnet windows forms designtime > august 2004 >
You're in the

dotnet windows forms designtime

group:

Custom controls in inherited forms


Custom controls in inherited forms roeegr NO[at]SPAM hotmail.com
8/6/2004 12:18:23 PM
dotnet windows forms designtime:
Hi
I have a tab control that was written in my org. It inherites directly
from System.Windows.Forms.Control.
I use it in a window form (MainForm) and it works just fine. But when
I try to create a new inherited form (ChildForm) that inherites from
MainForm - I can't edit the tab control in ChildForm. I CAN see it,
but can't get the desinger to focus on it or any of its tabs (and so I
can't add it other controls).
The tab control is declared as protected / public in MainForm.

Am I missing an attribute? A designer bug?

Thanks
Re: Custom controls in inherited forms Stoitcho Goutsev (100) [C# MVP]
8/6/2004 5:55:46 PM
It is by design I belive. You cannot modify the control that on the base
form unless you don't provide special root designer for that new form class
--

Stoitcho Goutsev (100) [C# MVP]


[quoted text, click to view]

Re: Custom controls in inherited forms roeegr NO[at]SPAM hotmail.com
8/7/2004 1:24:15 AM
When I tried to do the same with an ordinary panel - The designer
didn't let me change properties like size, location, etc. in the
inherited form but I could add controls to that panel. The designer
did "see" the panel and focus it (with a read only kind of frame).
It is not the same with my tab control - I can see it, but the
designer ignores it completely. When I click it the form itself gets
the focus - like the tab control is not there.


[quoted text, click to view]
Re: Custom controls in inherited forms draiko NO[at]SPAM rhenus.de
8/9/2004 12:44:49 AM
Hi Roee,

try this: Make the control protected on the form that you inherit from.

I suppose, the designer follows the standard inheritance pattern:
When you define a derived object you may change the sub-objects that are
declared as protected or public and may not change those declared as private.
And in does not metter how you define a new derived object (a new form):
(i) you edit the VB/c# text; or
(ii) you do this with the help of a designer.

If a sub-object is private, a designer may not see it at all.
After all, a control is nothing more but a property of the form it is
placed on (a special one, but still a property).
You may see a private sub-object "phisically" (it is drawn), but no one
may access/override this "property" but its original owner.

I suppose also that it does not metter is a control made protected or
public (i mean, the designer of a derived form can edit it in both cases).
Declaring it public will have other consequences (as for any other property)
but does not metter w.r.t. designers of an inherited form.

HTH,
Dima.

[quoted text, click to view]
AddThis Social Bookmark Button