把窗口分成左,右边(上下)三部分,并且在运行中可以动态调节其相对大小


   1.在一个空白的Form中加入Panel1,Align设为alLeft。  
 2.在Form1的空白处加入一个Splitter,可以看到它自动处于紧贴Panel1的位置,它的Align属性的缺省值也是alLeft。
   3.加入Panel2,Align设为alClient。
   4.在Panel2中加入Panel3,Align设为top
   5.在Panel2中加入一个Splitter,Align设为top
   6.在Panel2中加入Panel4,Align设为alClient
   7.完成,这样窗口就被切割成3块了,可以任意拖动每块区域大小。


 

unit Unit5;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;//TSplitter所在的单元

type
  TForm5 = class(TForm)
    Panel1: TPanel;
    Splitter1: TSplitter;
    Panel2: TPanel;
    Panel3: TPanel;
    Splitter2: TSplitter;
    Panel4: TPanel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form5: TForm5;

implementation

{$R *.dfm}

end.

 

object Form5: TForm5
  Left = 0
  Top = 0
  Caption = 'Form3'
  ClientHeight = 516
  ClientWidth = 390
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Splitter1: TSplitter
    Left = 185
    Top = 0
    Height = 516
    ExplicitLeft = 208
    ExplicitTop = 264
    ExplicitHeight = 100
  end
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 185
    Height = 516
    Align = alLeft
    Caption = 'Panel1'
    TabOrder = 0
    ExplicitLeft = 104
    ExplicitTop = 224
    ExplicitHeight = 41
  end
  object Panel2: TPanel
    Left = 188
    Top = 0
    Width = 202
    Height = 516
    Align = alClient
    Caption = 'Panel2'
    TabOrder = 1
    ExplicitLeft = 216
    ExplicitTop = 192
    ExplicitWidth = 185
    ExplicitHeight = 41
    object Splitter2: TSplitter
      Left = 1
      Top = 42
      Width = 200
      Height = 3
      Cursor = crVSplit
      Align = alTop
      ExplicitWidth = 473
    end
    object Panel3: TPanel
      Left = 1
      Top = 1
      Width = 200
      Height = 41
      Align = alTop
      Caption = 'Panel3'
      TabOrder = 0
      ExplicitLeft = 24
      ExplicitTop = 216
      ExplicitWidth = 185
    end
    object Panel4: TPanel
      Left = 1
      Top = 45
      Width = 200
      Height = 470
      Align = alClient
      Caption = 'Panel4'
      TabOrder = 1
      ExplicitLeft = 32
      ExplicitTop = 256
      ExplicitWidth = 185
      ExplicitHeight = 41
    end
  end
end