Toll Free: (877) 723-1442 U.S. and Canada
Support
ActiveX / COM
Visual C++ / MFC
Customer Spotlight
Corporate Partners
Contact Sales

Call center available M-F 9:00 - 6:00 US Eastern Time.

U.S. and Canada
(877) 723-1442

International
(517) 625-5729

Email

Resizing a Pane via Code

Author: Mike Palmatier
Posted: April 26, 2006
Environment: Visual Basic 6.0

To resize a pane via code you must use the SetSize method to set both the maximum and minimum pane widths to the same size. Setting both the minimum width and maximum width to the same size results in the pane getting resized to the specified settings but it also will "lock" the pane so it can not be resized.

To allow the pane to be resized the NormalizeSplitters method must be called, then you can use SetSize again to set the minimum and maximum width the pane can be resized. This time the pane will not get resized because NormalizeSplitters was called prior to setting the width and height.

    Dim A As Pane

 

    'Add a pane that is 50x50

    Set A = DockingPaneManager.CreatePane(1, 50, 50, DockLeftOf)

    A.Title = "Pane A"

 

    'Only needs to be called if setting the size in Form_Load

    DockingPaneManager.RecalcLayout

 

    'Setting the minimum and maximum track size to the same size

    'will resize the pane to the specified width\height and lock

    'the pane to the specified size.

    '

    'Below, the pane will be resized to 100x100 and can not be

    'resized

    DockingPaneManager.FindPane(1).MinTrackSize.SetSize 100, 100

    DockingPaneManager.FindPane(1).MaxTrackSize.SetSize 100, 100

 

    'Only needs to be called if setting the size in Form_Load

    DockingPaneManager.RecalcLayout

 

    'NOTE:

    'If the pane is docked to the Left\Right, then the "Width" will

    'be used, if docked to the Top\Bottom, then the "Height"

    'specified will be used. The only time both width and height

    'are used to size a pane is when the pane is floating.

 

    'Remembers previous pane size settings so that the next call

    'to SetSize will not resize the pane

    DockingPaneManager.NormalizeSplitters

 

    'Sets the minimum and maximum sizes the splitter can move

    'Note, this will not resize the pane since NormalizeSplitters

    'was called before the call to SetSize.  Now SetSize will

    'only specify how large/small the user can resize the pane.

    '

    'Below, the pane can be resized between 0x0 and 500x500.

    DockingPaneManager.FindPane(1).MinTrackSize.SetSize 0, 0

    DockingPaneManager.FindPane(1).MaxTrackSize.SetSize 500, 500

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Other products and/or company names may be trademarks or registered trademarks of their respective owners.