Unit uFullScreenButton;
Interface
Uses
Windows, SysUtils, Classes, Controls, Forms,
StdCtrls, ExtCtrls;
Type
TForm1 =
class(TForm)
Panel1 : TPanel;
Label1 : TLabel;
Button1: TButton;
Procedure FormCreate (Sender: TObject);
Procedure Button1Click (Sender: TObject);
End;
VAR
Form1: TForm1;
Implementation
{$R *.dfm}
Procedure TForm1.FormCreate(Sender: TObject);
Begin
Self.DoubleBuffered := True;
Panel1.DoubleBuffered:= True;
Self.SetBounds(0, 0, Screen.WorkAreaWidth, Screen.WorkAreaHeight);
Panel1.SetBounds(0, 85, (Self.ClientWidth), (Self.ClientHeight-85));
Label1.Caption:= '
LOADING...';
End;
Procedure TForm1.Button1Click(Sender: TObject);
Var
I: Integer;
B: TButton;
myTop, myLeft, countLeft, countTop,
btnWidth, btnHeight, maxLeft, panMaxH,
panMaxW: Integer;
Begin
btnWidth := 100;
btnHeight := 100;
countLeft := 0;
countTop := 0;
myTop := 0;
myLeft :=-100;
Label1.Show;
Form1.Update;
panMaxH:= (Panel1.ClientHeight
Div btnHeight);
panMaxW:= (Panel1.ClientWidth
Div btnWidth);
For I:= 1
To (panMaxH*panMaxW)
Do
Begin
myLeft:= myLeft +btnWidth;
If (Panel1.ClientWidth-(countLeft*btnWidth)) < btnWidth
Then
Begin
myLeft := 0;
myTop := myTop +btnHeight;
maxLeft := countLeft;
countLeft:= 0;
countTop := countTop +1;
End;
B:= TButton.Create(Self);
B.SetBounds(myLeft, myTop, btnWidth, btnHeight);
B.Parent:= Panel1;
countLeft:= countLeft +1;
End;
Label1.Hide;
Panel1.Show;
End;
End.