unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure WMNCHITTEST(var Mes:Tmessage); Message WM_NCHITTEST;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  Pts : array [1..8] of TPoint;
begin
  Pts[1] := Point( 100, 0 );
  Pts[2] := Point( 120, 80 );
  Pts[3] := Point( 200, 100 );
  Pts[4] := Point( 120, 120 );
  Pts[5] := Point( 100, 200 );
  Pts[6] := Point( 80, 120 );
  Pts[7] := Point( 0, 100 );
  Pts[8] := Point( 80, 80 );
  SetWindowRgn( Handle, CreatePolygonRgn( Pts, 8, WINDING ), True);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 Close;
end;

procedure TForm1.WMNCHITTEST(var Mes:Tmessage);
begin
  Mes.Result := HTCAPTION;
end;

end.
