Using WeifenLuo DockPanel Suite

coder picture coder · Dec 29, 2011 · Viewed 10k times · Source

I have just downloaded the WeifenLuo(Dock Panel Suite) and trying to work with that but I couldn't find a specific documentation on how to use it.

And I have gone through some of the SO questions and finally got something to get started.

Here is what I have done: I have created a ToolboxWindow class like shown below:

Public Class ToolboxWindow
    Inherits WeifenLuo.WinFormsUI.Docking.DockContent

    Public Sub New()

    End Sub
End Class

And trying to create an instance of this toolbox in this way:

Public Class Form1
    Private toolboxWindow As ToolboxWindow

    Public Sub New()
        Me.InitializeComponent()

        'Create new ToolboxWindow
        toolboxWindow = New ToolboxWindow()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
        'Show it
        toolboxWindow.Show(DockPanel1, DockState.DockLeft)
    End Sub
End Class

And the final result it shows me this way?

enter image description here

1.How to adjust the size of the toolbox.

2.If I have form2 with the dock panel how do I show in the form1

Thanks in Advance!

Answer

StephenD picture StephenD · Jan 4, 2012

Q1 How to adjust the size of the toolbox.

The DockPanel container has a DockLeftPortion property (Right, Bottom and Top too). This specifies the width of the left area as either pixels or a proportion of the available area. I haven't seen anything that allows it to take on the size of the docked controls.

Q2 If I have form2 with the dock panel how do I show in the form1

If you have two top level application forms each with a dock panel, you pass the appropriate dockpanel control as the first parameter to the Show() method.

Is this what you meant by Q2?