您的位置:首页 > 编程语言 > Delphi

delphi控件的停靠

2010-02-16 06:40 176 查看


把一个窗体或者控件变成可以停靠只需要两步:

(1)把DragKind特性设置为dkDock。

(2)把DragMode特性设置为dmAutomatic。

另外,TPanel控件有一个UseDockManager特性,如果为Ture,它的作用是将停靠在上面的控件的尺寸扩充为Panel的大小,即充满全部Panel空间。

演示代码:

新建一个VCL form工程,加入界面代码:

object Form1: TForm1
Left = 0
Top = 0
Caption = #25511#20214#20572#38752' '#29482#24735#33021
ClientHeight = 293
ClientWidth = 347
Color = clBtnFace
DockSite = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Shape1: TShape
Left = 208
Top = 48
Width = 105
Height = 97
DragKind = dkDock
DragMode = dmAutomatic
end
object Shape2: TShape
Left = 208
Top = 160
Width = 121
Height = 41
DragKind = dkDock
DragMode = dmAutomatic
end
object Panel1: TPanel
Left = 25
Top = 24
Width = 161
Height = 225
Caption = 'Panel1'
DockSite = True
TabOrder = 0
end
end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: