У меня проблема: при изменении размеров окна его содержимое размеры не меняет. Несмотря на.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus,
ExtCtrls, Buttons, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
MainMenu1: TMainMenu;
MenuItem1: TMenuItem;
Panel1: TPanel;
procedure Button1Click(Sender: TObject);
procedure Form1Activate(Sender: TObject);
procedure Form1Paint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
tMyBounds=record Left, Top, Width, Height: longint end;
tWinSet=record
winx, winy: LongInt;
Panel, Button: tMyBounds;
end;
var
Form1: TForm1;
WNorm, WMax, WDef: tWinSet;
{параметры содержимого - нормальное, максимизированное, текущее}
implementation
procedure WinCalc(x, y: LongInt; Form: tForm1; var WSet: tWinSet);
begin with WSet do begin
winx:=x; winy:=y;
Panel.Left:=Form.Panel1.Left; Panel.Top:=Form.Panel1.Top;
Button.Width:=Form.Button1.Width; Button.Height:=Form.Button1.Height;
Panel.Width:=x-(Panel.Left*2); Button.Left:=x-Button.Width-Panel.Left;
Panel.Height:=y-Panel.Top-Button.Height-16;
Button.Top:=Panel.Top+Panel.Height+8 end;
end;
{ TForm1 }
procedure TForm1.Form1Activate(Sender: TObject);
var WX: tWinSet;
begin
WinCalc(Form1.Width, Form1.Height-16, Form1, WNorm);
WinCalc(Screen.Width, Screen.Height-16, Form1, WMax);
WDef:=WNorm;{
With Panel1 do begin Left:=WX.Panel.Left; Top:=WX.Panel.Top;
Width:=WX.Panel.Width; Height:=WX.Panel.Height end;
With Button1 do begin Left:=WX.Button.Left; Top:=WX.Button.Top;
Width:=WX.Button.Width; Height:=WX.Button.Height end;}
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.Form1Paint(Sender: TObject);
begin
if Form1.WindowState=wsNormal then WDef:=WNorm else
if Form1.WindowState=wsMaximized then WDef:=WMax;
with Panel1 do begin Left:=WDef.Panel.Left; Top:=WDef.Panel.Top;
Width:=WDef.Panel.Width; Height:=WDef.Panel.Height end;
with Button1 do begin Left:=WDef.Button.Left; Top:=WDef.Button.Top;
Width:=WDef.Button.Width; Height:=WDef.Button.Height end;
end;
initialization
{$I unit1.lrs}
end.