Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Inconsistent Docking using WinForms

$
0
0
Hi All,

I have UserControls for the sections below the main menu which all have Dock set to Fill. This works absolutely fine and they were dragged onto the GUI using Visual C# Express. However, when I programatically try and add one, it docks it but also places it behind the menu (as seen in the screenshot). How can I prevent this?

http://i48.tinypic.com/2vn54ev.jpg

Image 1) The ProjectView UserControl docked incorrectly. This is the problematic part, it was added programattically (using the code here: {removed}). However it seems to be placing the control behind the menu rather than directly below it (like the PeopleView control that was added using the GUI)

Image 2) The "PeopleView" UserControl docked correctly onto the main form. This was done using the GUI by dragging an instance of PeopleView onto the display and then setting Dock to DockStyle.Fill

Image 3) the "PeopleView" UserControl on its own

Image 4) the "ProjectView" Usercontrol on its own

The code to add is identical to the designer, apart from the fact that it is this.Parent.Controls.Add rather than this.Controls.Add because the control I am trying to add is inside another UserControl.

Any ideas?

Thanks =)

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>