// Hiermit kann man
die Ausmaße eines Fensters auf einen minimalen und // Variante 1: Für alte Delphi-Versionen
...
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure minmax(var aMsg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
public
{ Public-Deklarationen}
end;
var
Form1: TForm1;
const
minimalhoehe: integer = 200;
maximalhoehe: integer = 300;
minimalbreite: integer = 250;
maximalbreite: integer = 400;
implementation
{$R *.DFM}
procedure TForm1.minmax(var aMsg: TWMGetMinMaxInfo);
begin
inherited;
with aMsg.MinMaxInfo^ do begin
ptMinTrackSize.x := minimalbreite;
ptMinTrackSize.y := minimalhoehe;
ptMaxTrackSize.x := maximalbreite;
ptMaxTrackSize.y := maximalhoehe;
end;
end;
// Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
maximalbreite := screen.width;
// Die maximale Breite des Fensters wurde auf Bildschirmbreite gestellt.
// Jetzt kann man das Fenster verbreitern (was vorher nicht möglich war).
left := 0;
width := screen.width;
end;
//-----------------------------------------------------
// Variante 2: Für neuere Delphi-Versionen
// (Variante 1 funktioniert bei neueren Delphi-Versionen natürlich auch)
procedure TForm1.FormCreate(Sender: TObject);
begin
constraints.maxheight := 300;
constraints.minheight := 200;
constraints.maxwidth := 400;
constraints.minwidth := 250;
end;
// Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
constraints.maxwidth := screen.width;
// Die maximale Breite des Fensters wurde auf Bildschirmbreite gestellt.
// Jetzt kann man das Fenster verbreitern (was vorher nicht möglich war).
left := 0;
width := screen.width;
end;
|





