We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Docking Window Hint

I''m programmatically adding a docking window with a treeview to an MDI form. The treeview is set to fill the whole panel, but when it appears it doesn''t. If I resize it, then the treeview fills the form. Any hints on what to do to get it to fill out right the first time?

4 Replies

AD Administrator Syncfusion Team May 4, 2005 09:54 PM UTC

Hi Jeff, I haven''t experienced any problems getting a control to fill a Form when I set DockingManager.DockToFill=true. If that''s what you''re doing, do you have a sample that demonstrates this. Alternatively, if you''re doing something else, could you please describe your alternate method? Regards, Gregory Austin Syncfusion Inc.

JJ Jeff Johnson May 5, 2005 12:25 PM UTC

This code is running in your ''mdidemo'' sample. It creates a tabbed window docked on the left of the application window. The treeview does not size properly unless you force it to redraw by stretching the window. Sub TestCreate() Dim tb As ToolBar ''There''s some additional resizing code to steal. tbSlnPanel Dim tv As TreeView ''tvNetwork Dim pnl As Panel ''pnlSlnToolBar Dim dw As Panel '' ''toolbar tb = New System.Windows.Forms.ToolBar() tb.Appearance = System.Windows.Forms.ToolBarAppearance.Flat tb.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {toolBarButton1, toolBarButton2, toolBarButton3, toolBarButton4, toolBarButton5, toolBarButton6, toolBarButton7}) tb.ButtonSize = New System.Drawing.Size(23, 20) tb.Divider = False tb.Dock = System.Windows.Forms.DockStyle.Fill tb.DropDownArrows = True tb.ImageList = ilCommon tb.Name = "tb" tb.ShowToolTips = True tb.Size = New System.Drawing.Size(121, 67) tb.TabIndex = 0 ''panel pnl = New System.Windows.Forms.Panel() '' pnl.SuspendLayout() pnl.Controls.AddRange(New System.Windows.Forms.Control() {tb}) pnl.Dock = System.Windows.Forms.DockStyle.Top pnl.Name = "pnl" pnl.Size = New System.Drawing.Size(121, 23) pnl.TabIndex = 23 ''treeview tv = New System.Windows.Forms.TreeView() '' ''dwNetwork '' dw = New System.Windows.Forms.Panel() '' dw.SuspendLayout() dw.Controls.AddRange(New System.Windows.Forms.Control() {tv, pnl}) Me.dockingManager1.SetEnableDocking(dw, True) dw.Location = New System.Drawing.Point(1, 21) dw.Name = "dw" dw.Size = New System.Drawing.Size(121, 352 * 0.75) dw.TabIndex = 16 Me.dockingManager1.SetDockLabel(dw, "Test It") Me.dockingManager1.SetDockIcon(dw, 12) Me.dockingManager1.SetAutoHideOnLoad(dw, True) '' dw.ResumeLayout(False) '' pnl.ResumeLayout(False) '' ''tv '' tv.Dock = System.Windows.Forms.DockStyle.Fill tv.ImageList = ilCommon tv.Location = New System.Drawing.Point(0, 23) tv.Name = "tv" tv.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Field Units", 11, 11, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Services", 11, 11, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Amber", 16, 16)}), New System.Windows.Forms.TreeNode("John", 15, 15), New System.Windows.Forms.TreeNode("Smith", 15, 15)}), New System.Windows.Forms.TreeNode("Marketing/Sales", 11, 11, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Steve 1", 16, 16), New System.Windows.Forms.TreeNode("Steve 2", 16, 16), New System.Windows.Forms.TreeNode("Caldito", 16, 16), New System.Windows.Forms.TreeNode("Luxor", 16, 16)}), New System.Windows.Forms.TreeNode("Deployment Servers", 17, 17, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Salem", 17, 17), New System.Windows.Forms.TreeNode("Amityville", 17, 17)}), New System.Windows.Forms.TreeNode("Technical Support", 14, 14, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Anton", 16, 16, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode(" Brad", 16, 16)})}), New System.Windows.Forms.TreeNode("Development", 11, 11, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Bill", 14, 14), New System.Windows.Forms.TreeNode("Mark", 14, 14), New System.Windows.Forms.TreeNode("Steve", 14, 14), New System.Windows.Forms.TreeNode("MaryAnn", 14, 14), New System.Windows.Forms.TreeNode("Print Server", 11, 11, New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("LP1", 17, 17), New System.Windows.Forms.TreeNode("LP2", 17, 17)})})}) tv.Size = New System.Drawing.Size(121, 329) tv.TabIndex = 1 End Sub

AD Administrator Syncfusion Team May 5, 2005 03:25 PM UTC

Hi Jeff, I wasn''t able to test your code snippet as it references a number of variables that weren''t included in the snippet. Would it be possible for you to send me your entire project, or at least the class file? If you''re concerned about confidentiality, you can create a DirectTrac incident. What I was able to determine is that you''re calling code from the sample''s constructor outside of the constructor. Due to the way VS.NET and DockingManager operate, that may result in different behavior. I would try moving the SetEnableDocking call to the very end of the sub, as I suspect that the early call causes the docking window to initialize before the TreeViewAdv is initialized, causing the incorrect size. Regards, Gregory Austin Syncfusion Inc.

JJ Jeff Johnson May 5, 2005 04:05 PM UTC

"I would try moving the SetEnableDocking call to the very end of the sub, as I suspect that the early call causes the docking window to initialize before the TreeViewAdv is initialized, causing the incorrect size." THAT''S IT!!! :) Thank you very much Gregory. It''s beautiful, now.

Live Chat Icon For mobile
Up arrow icon