其他分享
首页 > 其他分享> > 创建异形窗口[2]

创建异形窗口[2]

作者:互联网

创建异形窗口[2]

本例效果图:

o_84303.gif
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.
posted on 2008-04-30 16:59  万一  阅读(2997)  评论(0)  编辑  收藏

标签:窗口,Sender,异形,创建,TForm1,TObject,end,pts,procedure
来源: https://blog.51cto.com/u_14617575/2746296