界面开发套包Toolkit Pro使用技巧:如何通过代码调整窗格的大小

Xtreme Toolkit Pro是MFC开发中最全面界面控件套包,它提供了Windows开发所需要的11种主流的Visual C++ MFC控件,包括Command Bars、Controls、Chart Pro、Calendar、Docking Pane、Property Grid、Report Control、Shortcut Bar、Syntax Edit、Skin Framework 和Task Panel。如果对产品感兴趣的话欢迎下载Xtreme Toolkit Pro最新试用版! 点击获取更多免费Xtreme Toolkit Pro教程、视频、示例!

若要通过代码调整窗格的大小,必须使用SetSize方法将最大和最小窗格宽度设置为相同的大小。将最小宽度和最大宽度设置为相同大小会导致窗格被调整为指定的设置大小,但是也会“锁定”窗格,因此无法调整大小。

若要调整窗格的大小,必须调用NormalizeSplitters方法,然后可以再次使用SetSize设置可以调整窗格的最小和最大宽度。这次不会调整窗格的大小,因为在设置宽度和高度之前已调用NormalizeSplitters。

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

 

今天的内容就是这些了,下载最新版Xtreme ToolKit Pro并在下方评论区分享您对该产品的想法。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值