我有一个带有两个面板和一个拆分器的表格。一个面板 (panel2) 右对齐,拆分器右对齐,第二个面板 (panel1) 客户端对齐。 当我将分割器向左移动时,panel2 的宽度按预期增加。当我将分离器移至右侧时,它会按预期减少。当我将分割器向右移动超过其 minSize 时,panel2 就会消失,分割器会一直向右移动,而 panel1 会占据客户区的所有其余部分。 我预计分离器不会移动超过 minSize,并且 panel2 将保持可见,其宽度等于分离器的 minSize。 这是一个测试应用程序
表格
object Form17: TForm17
Left = 0
Top = 0
Caption = 'Form17'
ClientHeight = 442
ClientWidth = 628
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
TextHeight = 15
object Splitter1: TSplitter
Left = 440
Top = 0
Height = 442
Align = alRight
MinSize = 150
ExplicitLeft = 360
ExplicitTop = 216
ExplicitHeight = 100
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 440
Height = 442
Align = alClient
Caption = 'Panel1'
TabOrder = 0
ExplicitLeft = 64
ExplicitTop = 104
ExplicitWidth = 185
ExplicitHeight = 41
end
object Panel2: TPanel
Left = 443
Top = 0
Width = 185
Height = 442
Align = alRight
Caption = 'Panel2'
TabOrder = 1
ExplicitLeft = 448
ExplicitTop = 128
ExplicitHeight = 41
end
end
代码
unit Unit17;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TForm17 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Splitter1: TSplitter;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form17: TForm17;
implementation
{$R *.dfm}
end.