创建异形窗口[2]

本例效果图:

创建异形窗口[2]

unit Unit1;



interface



uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls;



type

  TForm1 = class(TForm)

    Button1: TButton;

    procedure FormCreate(Sender: TObject);

    procedure Button1Click(Sender: TObject);

    procedure FormDblClick(Sender: TObject);

  end;



var

  Form1: TForm1;



implementation



{$R *.dfm}



procedure TForm1.FormCreate(Sender: TObject);

begin

  Button1.Caption := '创建';

end;



procedure TForm1.Button1Click(Sender: TObject);

const

  pts: array[0..3] of TPoint = (

    (x:10; y:40),

    (x:46; y:120),

    (x:82; y:40),

    (x:46; y:10)

  );

var

  rgn: HRGN;

begin

  rgn := CreatePolygonRgn(pts, Length(pts), 1); {1:ALTERNATE; 2:WINDING}

  SetWindowRgn(Handle, rgn, True);

end;



procedure TForm1.FormDblClick(Sender: TObject);

begin

  Close;

end;



end.


 
   

你可能感兴趣的:(创建)