Answer the question
In order to leave comments, you need to log in
How in Delphi to make the frame completely overlap the form on which it is located (taking into account the fact that the form can be scrolled)?
Hello. My application has multiple frames. All of them are located on the same form - on the main one. In some frames, the height can be very large, so it should be possible to scroll the form on which such frames are located. I've set the autoscroll flag to true for the main form where all the frames are located. And I wrote the following code - so that the height and width of the frames correspond to the form.
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Unit3;
type
TForm1 = class(TForm)
Frame31: TFrame3;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure SetPosition;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
SetPosition;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
SetPosition;
end;
procedure TForm1.SetPosition;
begin
Frame31.Left := 0;
Frame31.Top := 0;
Frame31.Width := Form1.Width;
Frame31.Height := Form1.Height;
end;
end.
unit Unit3;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TFrame3 = class(TFrame)
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
end.
Answer the question
In order to leave comments, you need to log in
First:
Frame31.Left := 0;
Frame31.Top := 0;
Frame31.Width := Form1.ClientWidth;
Frame31.Height := Form1.ClientHeight;
Align = alClient
frames, the height can be very large, so it should be possible to scroll the form
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question