创建异形窗口[6]

创建异形窗口[6]

本例效果图:

创建异形窗口[6]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    procedure FormCreate(Sender: TObject);
    procedure Panel1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var
  f: Boolean;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Self.Color := clWhite;
  Panel1.ParentBackground := False;
end;

procedure TForm1.Panel1Click(Sender: TObject);
var
  rgn: HRGN;
begin
  f := not f;
  if f then
    rgn := CreateEllipticRgn(0, 0, Panel1.Width, Panel1.Height)
  else
    rgn := CreateRectRgn(0, 0, Panel1.Width, Panel1.Height);

  SetWindowRgn(Panel1.Handle, rgn, True)
end;

end.
posted on 2008-05-01 11:24  万一  阅读(2855)  评论(0)  编辑  收藏
上一篇:创建异形窗口[2]


下一篇:WPF 移动控件、拖动边框修改控件大小