创建异形窗口[4]
创建异形窗口[4]
涂孟超 发表于4年前
创建异形窗口[4]
  • 发表于 4年前
  • 阅读 2
  • 收藏 0
  • 点赞 0
  • 评论 0

移动开发云端新模式探索实践 >>>   

本例效果图:


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    RadioGroup1: TRadioGroup;
    procedure FormCreate(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormDblClick(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

var
  pt: TPoint;
  RGN_Mode: Integer = RGN_AND;

procedure TForm1.FormCreate(Sender: TObject);
begin
  pt.X := Width;
  pt.Y := Height;
  RadioGroup1.Items.CommaText := 'RGN_AND,RGN_OR,RGN_XOR,RGN_DIFF,RGN_COPY';
  RadioGroup1.ItemIndex := 0;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
  RGN_Mode := RadioGroup1.ItemIndex + 1;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  rgn1,rgn2: HRGN;
begin
  rgn1 := CreateEllipticRgn(10,10,110,110);
  rgn2 := CreateEllipticRgn(80,10,180,110);
  CombineRgn(rgn1, rgn1, rgn2, RGN_Mode);
  SetWindowRgn(Handle, rgn1, True);
end;

procedure TForm1.FormDblClick(Sender: TObject);
var
  rgn: HRGN;
begin
  rgn := CreateRectRgn(0, 0, pt.X, pt.Y);
  SetWindowRgn(Handle, rgn, True);
end;

end.

 
 
 
 
 

 

 

  
  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 12
博文 2004
码字总数 14107
×
涂孟超
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: