procedure TForm1.FormResize(Sender: TObject); begin PnlB1.Height := PnlA1.Height div 2; end; procedure TForm1.FormCreate(Sender: TObject); begin // Propriétés paramétrables, bien évidemment, dans // l'inspecteur d'objet : PnlB1.Align := alTop; PnlB2.Align := alClient; end;
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) GbxA: TGroupBox; GbxB: TGroupBox; PnlB1: TPanel; PnlB2: TPanel; PnlB3: TPanel; PnlB4: TPanel; PnlB5: TPanel; PnlA1: TPanel; PnlA2: TPanel; PnlA3: TPanel; PnlA4: TPanel; procedure FormResize(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormResize(Sender: TObject); begin PnlB2.Height := PnlA1.Height div 2; end; end.
object Form1: TForm1 Left = 455 Top = 259 Width = 308 Height = 551 Caption = 'Form1' Color = clBtnFace Constraints.MinHeight = 551 Constraints.MinWidth = 308 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnResize = FormResize PixelsPerInch = 96 TextHeight = 13 object GbxA: TGroupBox Left = 0 Top = 0 Width = 150 Height = 517 Align = alLeft Caption = 'Colonne A (alLeft)' TabOrder = 0 object PnlA1: TPanel Left = 2 Top = 15 Width = 146 Height = 200 Align = alClient Caption = 'A1 (alClient)' Color = clScrollBar TabOrder = 0 end object PnlA2: TPanel Left = 2 Top = 215 Width = 146 Height = 100 Align = alBottom Caption = 'A2 (alBottom)' TabOrder = 1 end object PnlA3: TPanel Left = 2 Top = 315 Width = 146 Height = 100 Align = alBottom Caption = 'A3 (alBottom)' TabOrder = 2 end object PnlA4: TPanel Left = 2 Top = 415 Width = 146 Height = 100 Align = alBottom Caption = 'A4 (alBottom)' TabOrder = 3 end end object GbxB: TGroupBox Left = 150 Top = 0 Width = 150 Height = 517 Align = alClient Caption = 'Colonne B (alClient)' TabOrder = 1 object PnlB1: TPanel Left = 2 Top = 15 Width = 146 Height = 100 Align = alClient Caption = 'B1 (alClient)' Color = clScrollBar TabOrder = 0 end object PnlB2: TPanel Left = 2 Top = 115 Width = 146 Height = 100 Align = alBottom Caption = 'B2 (alBottom)' TabOrder = 1 end object PnlB3: TPanel Left = 2 Top = 215 Width = 146 Height = 100 Align = alBottom Caption = 'B3 (alBottom)' TabOrder = 2 end object PnlB4: TPanel Left = 2 Top = 315 Width = 146 Height = 100 Align = alBottom Caption = 'B4 (alBottom)' TabOrder = 3 end object PnlB5: TPanel Left = 2 Top = 415 Width = 146 Height = 100 Align = alBottom Caption = 'B5 (alBottom)' TabOrder = 4 end end end
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question