урок на делфи 49 - Круглая программа
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
{пояснение к программе тут https://youtu.be/tU1mCc9yvxg}
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
FormRgn: hRgn;
begin
Form1.BorderStyle:=bsNone;
Form1.Height := 500;
Form1.Width :=500;
FormRgn := CreateRoundRectRgn(1, 1, Form1.Width - 1,Form1.height - 1, Form1.width, Form1.height);
SetWindowRgn(Form1.Handle, FormRgn, TRUE);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
FormRgn: hRgn;
begin
Form1.BorderStyle:=bsNone;
FormRgn := CreateRoundRectRgn(1, 1, Form1.Width - 1,Form1.height - 1, Form1.width, Form1.height);
SetWindowRgn(Form1.Handle, FormRgn, TRUE);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Position:=poScreenCenter;
end;
end.