lazarus/examples/canvas_test/canvastest.lpi,shapedwindowtest form:I guess from the source code this unit will generate a borderless,red circle window with a close button inside it.But--
a). Lazarus 4.0+fpc 3.2.2 Version May 5,2025 under my machine win10 64 bit,it doese not take effect.Just generate a borderless,red rectangle window with a close button inside.
b). But rather,the commented code will do take effect.
Any tips please?
unit shapedwindowtest;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, LCLIntf, LCLType;
type
{ TfrmShapedWindow }
TfrmShapedWindow = class(TForm)
btnClose: TButton;
procedure btnCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
public
end;
var
frmShapedWindow: TfrmShapedWindow;
implementation
{$R *.lfm}
{ TfrmShapedWindow }
procedure TfrmShapedWindow.FormShow(Sender: TObject);
{var
Rgn: HRGN;
begin
Rgn := LCLIntf.CreateEllipticRgn(0, 0, 200, 200);
LCLIntf.SetWindowRgn(Handle, Rgn, False);
LCLIntf.DeleteObject(Rgn);}
var
Shape: TBitmap;
begin
Shape := TBitmap.Create;
try
Shape.Width := 200;
Shape.Height := 200;
Shape.Canvas.Ellipse(0, 0, 200, 200);
SetShape(Shape);
finally
Shape.Free;
end;
end;
procedure TfrmShapedWindow.btnCloseClick(Sender: TObject);
begin
Close;
end;
end.