Class TfrmRestrictSize (unit UnitMain)

Inherits from

TForm

This example show how you can specify the minimum and maximum sizes of a window, showing it directly to the user by blocking him during resize. It also shows predefined size and position of windows when Maximizing it.

Constructors



Functions

procedure FormResize(Sender: TObject);


procedure FormShow(Sender: TObject);

This represents the maximum size of the Window

procedure RestrictSize(var msg: TMessage);

You must handle the WM_GETMINMAXINFO message

procedure TfrmRestrictSize.


procedure ShowSize;

Public declarations

Properties

Events

Variables

Label1 : TLabel;


Label2 : TLabel;


Label3 : TLabel;


Label4 : TLabel;


Memo1 : TMemo;


Panel1 : TPanel;



Constructors


Functions


procedure FormResize(Sender: TObject);


procedure FormShow(Sender: TObject);

This represents the maximum size of the Window


procedure RestrictSize(var msg: TMessage);

You must handle the WM_GETMINMAXINFO message

procedure TfrmRestrictSize.RestrictSize(var Msg: TMessage); var p: ^TPoint; begin p := Pointer(Msg.lParam+1* SizeOf(TPoint)); p^.x := 450; p^.y := 450; p := Pointer(Msg.lParam+2* SizeOf(TPoint)); p^.x := 200; p^.y := 200; p := Pointer(Msg.lParam+3* SizeOf(TPoint)); p^.x := 320; p^.y := 200; p := Pointer(Msg.lParam+4* SizeOf(TPoint)); p^.x := 640; p^.y := 480; end;


procedure ShowSize;

Public declarations


Properties


Events


Variables


Label1 : TLabel;


Label2 : TLabel;


Label3 : TLabel;


Label4 : TLabel;


Memo1 : TMemo;


Panel1 : TPanel;