CropForms (Delphi)
Contents
Description
The following code determines the height of all forms on the screen and resizes any that are taller than the screen height.
Code
procedure TForm1.Button1Click(Sender: TObject);
var I: Integer;
begin
with Screen do
for I := 0 to FormCount-1 do
begin
if Forms[I].Top < 0 then
begin
Forms[I].Height := Forms[I].Height + Forms[I].Top;
Forms[I].Top := 0;
end;
if Forms[I].Left < 0 then
begin
Forms[I].Width := Forms[I].Width + Forms[I].Left;
Forms[I].Left := 0;
end;
if Forms[I].Left + Forms[I].Width > Width then
Forms[I].Width := Width - Forms[I].Left;
if Forms[I].Top + Forms[I].Height > Height then
Forms[I].Height := Height - Forms[I].Top;
end;
end;
Uses
- Vcl.Forms.TScreen.Height ( fr | de | ja )
- Vcl.Forms.TScreen.Width ( fr | de | ja )
- Vcl.Forms.Screen ( fr | de | ja )