Pokud v Create zakažu proceduru NewWindowRgn tak to vykresli.
constructor TForm1.Create(AOwner: TComponent);
begin
inherited;
NewWindowRgn;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Form1.canvas.Font.Size:=18;
Form1.Canvas.Font.Style := [fsBold, fsUnderline];
Form1.Canvas.Font.Name:= 'Times New Roman';
Form1.Canvas.TextOut(200, 100, 'ahoj');
end;
procedure TForm1.NewWindowRgn;
var
i, CoordX, CoordY: Integer;
FormRgn, NewRgn: THandle;
begin
CoordX:=(Width-ClientWidth) div 2;
CoordY:=Height-ClientHeight-4;
FormRgn:=CreateRectRgn(0, 0, Width, Height);
NewRgn:= CreateRectRgn(
CoordX,
CoordY,
CoordX+ClientWidth,
CoordY+ClientHeight);
CombineRgn(FormRgn, FormRgn, NewRgn, RGN_DIFF);
for i:= 0 to ControlCount -1 do
with Controls[i] do
begin
NewRgn:= CreateRectRgn(
CoordX + Left,
CoordY + Top,
CoordX + Left + Width,
CoordY + Top + Height);
CombineRgn(FormRgn, FormRgn, NewRgn, RGN_OR);
end;
SetWindowRgn(Handle, FormRgn, True);
end;
procedure TForm1.Resize;
begin
inherited;
NewWindowRgn;
end;