Guides & Tutorials (beta)

Resizing a Pane via Code

by Mike Palmatier Visual Basic 6 Created on 04/26/2008  |  Updated on 07/31/2024 0/5 ( 0 votes )

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

User Comments

No comments yet, sign in to comment.

Secure Transactions

Online transactions are secure and protected.


Ssl seal 1
This site is protected by Trustwave's Trusted Commerce program
CompliAssure Secured

Money Back Guarantee

If you are not 100% happy with your purchase within 30 days, you can return it for any reason. Your satisfaction is our priority!


Satisfication Guarantee

Contact sales@codejock.com for more details.