Thursday, April 9, 2009

Resize Form even if it is borderless

We may make a form without borders to show some additional information using some popup windows. However, a borderless form will no longer resizable.

Use the following code to make a borderless form resizable:

type
TForm1 = class(TForm)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
BorderStyle := bsNone;
inherited;
Params.ExStyle := Params.ExStyle or WS_EX_STATICEDGE;
Params.Style := Params.Style or WS_SIZEBOX;
end;

No comments: