Click here to Skip to main content
12,501,845 members (52,366 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Containers Scrolling
I have several controls that follow a similar pattern and require the same resizing logic. I am using the XPPanel controls from this Code Project Full-featured XP Style Collapsible Panel

So my approach is to create a derived control from the XPPanel control that has several containers and a DataGridView control. The Hierarchy of the derived control will be:

1 XPPanel
2 Collapsible Group Box - Search Criteria
2 Group Box - Results
3 DataGridView
3 Panel for buttons
3 Collapsible Group Box - Details for selected grid control

The sizing algorithm is to adjust the size of the datagridview based on the size of the XPPanel (Driven by monitor resolution and user sizing) and the other group boxes and panel. The goal is to balance the amount of rows visible against the amount of details that can be seen without having to scroll the window.

I want this to be a control that I can derive each of the specific controls from so I can have this class handle the resizing logic and setting the scrolling min sizes.

So my idea was to create the derived class for each of the final controls and then fill the group boxes and the Panel with the appropriate controls for that specific control.

I did something similar when I created a Dialog Control that was derived from a form control and contained the OK and Cancel button. Then I derived the actual dialog boxes from this control.

The problem I am running into is when I try to create a control derived from XPPanel the designer screen does not let me place the group boxes, panel and datagridview so they display as they would at run time. Instead I just get an icon and text that represent the control.

Is what I am trying to do possible?

Can someone suggest a better way to resolve the problem?

Should I be using Layout Controls?

Some more Details:

I am using VS 2005
Posted 5-Jan-13 8:51am
Comments
BillWoodruff 5-Jan-13 17:13pm
   
As I understand it, you can't get the designer view you want, but, at run-time, do your derived Controls appear where you want them to be ?

I doubt you will get an answer to this question, since it involves going back into the code of a CP 2004 article and trying to figure out how it works, and using VS 2005.

But, I hope you do get an answer !

Have you searched CP for more recent articles on "collapsible" Container Controls ?

good luck, Bill
jibesh 5-Jan-13 20:14pm
   
Have you heard about Inherited User Controls in C#, partial of your requirement can be met by this.
Bill Langlais 5-Jan-13 22:40pm
   
Bill, Thanks for taking the time to respond. I believe what I am looking for is Visual Inheritance. I believe this is the ability of a control to inherit from another control and have it be displayed in the designer.

The sizing part is the ultimate goal but the problem is with the solution I am trying.

I want to be able to create a user control that contains some containers and then be able to add controls to those containers. What I am going to try next is just a simple case with a user control that has two panels. Then derive another control from the user control and see if I can add to the two panels.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 5 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100