Panels Containing UserControl Problem

mpappert

Regular
Joined
Oct 5, 2002
Messages
58
Location
Ottawa, ON, Canada
Hey Everyone ...

I've created my mainForm which I've embedded three panel controls called 'pnlTitleBar' , 'pnlToolbar' and 'pnlView' respectively. I've create a custom TitleBar which I've 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).

I've created two UserControls named 'viewToolbar' and 'viewDashboard'. On the viewToolbar I've 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 won't Fill .. it stays the same size as what is in the IDE ... I'm sure I'm 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?
 
I'm not sure if my forms will work unless you have the Infragistics UltraToolbarManager control and the Janus Controls for .NET suite installed. But I've attached a screenshot of my form from the IDE so you can maybe get a better idea of what I'm trying to do. I'm 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 Outlook's Contacts View or Inbox View.

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

M.
 

Attachments

I can see what you're 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 you're trying to add?
 
What I've done is added a New UserControl and then dropped another control on that form. I haven't setup any other methods or properties. So I guess in one sense it is a custom control of mine, but not really .. it's more of a container ...

M.
 
Back
Top