Изменение размеров формы, без рамки
Добавлено: 18.09.2009 08:00:51
Есть форма без рамки (bsNone) и создан регион. Как сделать чтобы можно было изменять размеры формы (растягивать) ?
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Windows, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
Var R : TRect;
Rgn : HRGN;
begin
Form1.BorderStyle := bsNone;
R := ClientRect;
Rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 7, 7);
SetWindowRgn(Handle, Rgn, True);
DeleteObject(Rgn);
end;
procedure TForm1.FormPaint(Sender: TObject);
Var R : TRect;
Rgn : HRGN;
begin
R := ClientRect;
Rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 7, 7);
SetWindowRgn(Handle, Rgn, True);
DeleteObject(Rgn);
end;
initialization
{$I unit1.lrs}
end.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Windows, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
Var R : TRect;
Rgn : HRGN;
begin
Form1.BorderStyle := bsNone;
R := ClientRect;
Rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 7, 7);
SetWindowRgn(Handle, Rgn, True);
DeleteObject(Rgn);
end;
procedure TForm1.FormPaint(Sender: TObject);
Var R : TRect;
Rgn : HRGN;
begin
R := ClientRect;
Rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 7, 7);
SetWindowRgn(Handle, Rgn, True);
DeleteObject(Rgn);
end;
initialization
{$I unit1.lrs}
end.