Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / August 2004

Tip: Looking for answers? Try searching our database.

Custom controls in inherited forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roee - 06 Aug 2004 20:18 GMT
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
Roee
Stoitcho Goutsev \(100\) [C# MVP] - 06 Aug 2004 22:55 GMT
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
Signature


Stoitcho Goutsev (100) [C# MVP]

> Hi
> I have a tab control that was written in my org. It inherites directly
[quoted text clipped - 10 lines]
> Thanks
> Roee
Roee - 07 Aug 2004 09:24 GMT
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.

> 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
[quoted text clipped - 12 lines]
> > Thanks
> > Roee
DRaiko - 09 Aug 2004 08:44 GMT
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.

> 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
[quoted text clipped - 12 lines]
> > Thanks
> > Roee

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.