1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Buttons, Dialogs, ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
BtnUpPanel1 : TButton;
BtnDownPanel1 : TButton;
procedure BtnUpPanel1Click(Sender : TObject);
procedure BtnDownPanel1Click(Sender : TObject);
procedure FormCreate(Sender: TObject);
private
Pnl1 : TPanel;
Pnl2 : TPanel;
Pnl3 : TPanel;
Pnl4 : TPanel;
Sbn1 : TSpeedButton;
Procedure CreationPanel(Sender: TObject);
Procedure PositionnePanel(Sender: TObject);
Procedure Sbn1Click(Sender: TObject); // activation du Panel 4
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
Const
Hauteur = 40;
procedure TForm1.FormCreate(Sender: TObject);
begin
CreationPanel(Sender);
end;
Procedure TForm1.PositionnePanel(Sender: TObject);
begin
With Self do begin
Pnl1.Visible:=true;
Pnl2.Visible:=true;
Pnl3.Visible:=true;
end;
end;
Procedure TForm1.CreationPanel(Sender: TObject);
begin
//-------------------------------------------------------------- Panel 4
Pnl4:=Tpanel.Create(Self);
With Pnl4 do begin
Parent:= Self;
Name:='Pnl4';
Caption:='Panel 4';
height:=Hauteur;
Align:=alTop;
Visible:=False;
Color:=ClDefault;
top := 3 * Hauteur;
end;
//-------------------------------------------------------------- Panel 3
Pnl3:=Tpanel.Create(Self);
With Pnl3 do begin
Parent:= Self;
Name:='Pnl3';
Caption:='Panel 3';
height:=Hauteur;
Align:=alTop;
Visible:=false;
Color:=ClDefault;
top := 2 * Hauteur;
end;
//-------------------------------------------------------------- Panel 2
Pnl2:=Tpanel.Create(Self);
With Pnl2 do begin
Parent:= Self;
Name:='Pnl2';
Caption:='Panel 2';
height:=Hauteur;
Align:=alTop;
Visible:=false;
Color:=ClDefault;
top := Hauteur;
end;
//-------------------------------------------------------------- Panel 1
Pnl1:=Tpanel.Create(Self);
With Pnl1 do begin
Parent:= Self;
Name:='Pnl1';
Caption:='Panel 1';
height:=Hauteur;
Align:=alTop;
Visible:=false;
Color:=ClDefault;
top := 0;
end;
//--------------------------------------- Bouton d'activation du panel 4
Sbn1:=TSpeedButton.Create(Pnl1);
With Sbn1 do begin
Parent:=Pnl1;
Name:='Sbn1';
Caption:='Pnl 4';
height:=28;
width :=34;
NumGlyphs:=0;
Top:=1;
Hint:='Activation Panel 4';
ShowHint:=true;
visible:=true;
enabled:=true;
OnClick:=@Sbn1Click;
end;
PositionnePanel(Sender);
end;
Procedure TForm1.Sbn1Click(Sender: TObject);
begin
Pnl4.Visible:=true;
end;
end. |
Partager