Is there a way to round Delphi VCL Form borders?

Viewed 1052

I would like the VCL form to have rounded corners like in the image below :

rounded corners

(For now the shadow is not needed, only need rounded corners).

I've already tried some code, but there doesn't seem to be any changes..

unit UMainWindow;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, 
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TFMainWindow = class(TForm)
  procedure FormCreate(Sender: TObject);
  end;

var
  FMainWindow: TFMainWindow;

implementation

procedure TFMainWindow.FormCreate(Sender: TObject);
var
  rgn: HRGN;
begin
  rgn := CreateRoundRectRgn(0, 0,ClientWidth,ClientHeight,40,40);
  SetWindowRgn(Handle, rgn, True);
end;

end.

And this is my result : not really rounded corners

0 Answers
Related