Panels Containing UserControl Problem

mpappert

Well-known member
Joined
Oct 5, 2002
Messages
58
Location
Ottawa, ON, Canada
Hey Everyone ...

Ive created my mainForm which Ive embedded three panel controls called pnlTitleBar , pnlToolbar and pnlView respectively. Ive create a custom TitleBar which Ive placed in the pnlTitleBar panel (basically, a label with a graphic and text). The other two panels will host the Toolbar and the application "Views". The Views will be the different screens (like what Outlook displays for the different folders - contacts, inbox etc).

Ive created two UserControls named viewToolbar and viewDashboard. On the viewToolbar Ive added a tlbMain (toolbar) and on the viewDashboard it has a Janus ExplorerBar control.

I have set the pnlView to dock to Top, Left, Bottom, Right and I use the following code to display the panels ...

Code:
[MP]   Assign the View viewToolbar to pnlToolbar
Dim Toolbar As New viewToolbar()
Toolbar.Dock = DockStyle.Fill
Me.pnlToolbar.Controls.Add(Toolbar)

[MP]   Assign the View viewDashboard to pnlView
Dim Dashboard As New viewDashboard()
Dashboard.Dock = DockStyle.Fill
Me.pnlView.Controls.Add(Dashboard)

My problem is this ... the pnlView wont Fill .. it stays the same size as what is in the IDE ... Im sure Im missing something silly, but still being new to VB.NET, any help is much appreciated!

Thanks!
M.
 
Can you not add these controls and set their dock styles in the windows forms designer? Perhaps you could attach an example so we can visualize what you are trying to do?
 
Im not sure if my forms will work unless you have the Infragistics UltraToolbarManager control and the Janus Controls for .NET suite installed. But Ive attached a screenshot of my form from the IDE so you can maybe get a better idea of what Im trying to do. Im trying to create an Outlook style interface, with a custom TitleBar (the titlebar will have the application logo in it).

As you can see in the screenshot, the white bar on top is the pnlTitleBar and hosts a label (just white background for now). The pnlToolbar gets linked to the ViewToolbar UserControl (to display the Toolbars and Menu) and the pnlView is used to display the screens. Similar to Outlooks Contacts View or Inbox View.

I have set the controls Dock to Fill, but the UserControl itself has no Dock item in the IDE Properties ... I can only set it at run-time.

M.
 
I can see what youre trying to do, and it should certainly work. Anything that can be added to a container on a windows form must derive from Control, and Control has a Dock property so it should be there.

Is this your own UserControl youre trying to add?
 
What Ive done is added a New UserControl and then dropped another control on that form. I havent setup any other methods or properties. So I guess in one sense it is a custom control of mine, but not really .. its more of a container ...

M.
 
Back
Top