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 / WinForm General / September 2006

Tip: Looking for answers? Try searching our database.

Inherited control with design mode capabilities

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stanislav Peťko - 06 Sep 2006 13:12 GMT
Hello

How can I make inherited control, which I can edit in design mode: add more
controls on it etc. Basically, I need a usercontrol, but it cannot by inherited
form UserControl class but from some another class (say GroupBox). If I inherit
directly form GroupBox, I loose design mode possibilities. I cannot add more
controls on it in design mode (well, I can add them, but it's different.
I cannot position and size it visually).

Is there a way to accomplish this?

Thanks, Stano
Stoitcho Goutsev (100) - 06 Sep 2006 15:21 GMT
What you need to do is to write your own designer to it and attach it to the
new control. If you want to be able to drop other controls over use
ParentControlDesigner.

I'd suggest reading through:
http://windowsforms.net/articles/shapedesigner.aspx

--
HTH
Stoitcho Goutsev (100)

> Hello
>
[quoted text clipped - 8 lines]
>
> Thanks, Stano
Stanislav Peťko - 29 Sep 2006 14:44 GMT
Hello

> What you need to do is to write your own designer to it and attach it
> to the new control. If you want to be able to drop other controls over
[quoted text clipped - 3 lines]
> http://windowsforms.net/articles/shapedesigner.aspx
> --

This is not my problem. I probably did not describe my problem clearly, so
I will try it now. I use VS2005.

If I want to create my own control, standard way in VS is to add new UserControl.
Then in design mode of THIS CONTROL I can put more controls on it and in
code to add some methods, properties, events...

But I want to create a control, which is INHERITED form some other control,
I have to add "Inherited User Control". The problem is, that I can choose
only from some control to inherit from (it seems the only choices VS offers
me is some other UserControls). If I choose something, I can edit THIS inherited
control in design mode as standard UserControl - I can put other controls
on it, position it there and so on...

But I want to inherit from some other graphical control ... say GroupBox,
to have its properties immediately available in code, but this is not possible.
If I change inheritance of my class to GroupBox, I loose design mode possibilities.
I cannot put more controls on it and position and size them.
To be exact, I can put controls on it, but they act like nonvisual components.
I cannot size and position them visually. :(

For now the only way how to achieve what I want is to create ordinal UserControl
and put GroupBox on it (with Docking set to Fill), and create properties
to access properties of this groupbox. But this was just an example and I
would like to inherit directly form more complex visual controls and keep
visual editing of this control working.

And by visual editing I mean editing directly this control, not when it itself
is put on some form.

Thanks, Stano
Stoitcho Goutsev (100) - 29 Sep 2006 15:43 GMT
Stanislav,

The article that I suggested explains why the what you want to do is
imposible. UserControls and Forms are the only controls in the framework
that have root designer. That is you can open them in their own designer and
add more controls to them. The rest of the controls can be dropped over some
other control that has root designer (form or user control), but they cannot
be edited as a separate entity.
And for me it makes perfect sense.

Signature

Stoitcho Goutsev (100)

> Hello
>
[quoted text clipped - 39 lines]
>
> Thanks, Stano

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.