Главная » Delphi » Графика » как из TIcon вытащить маску?

как из TIcon вытащить маску?

11:21
unit Unit1;
 
interface
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
 
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
mask:TBitmap;
public
{ Public declarations }
end;
 
var
Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);
var
IconInfo : TIconInfo;
begin
mask:=TBitmap.Create;
GetIconInfo(Application.Icon.Handle,IconInfo);
mask.Handle := IconInfo.hbmMask;
end;
 
procedure TForm1.FormDestroy(Sender: TObject);
begin
mask.Free;
end;
 
procedure TForm1.FormPaint(Sender: TObject);
begin
BitBlt(Canvas.Handle,0,0,mask.Width,mask.Height,mask.Canvas.Handle,0,0,SRCCOPY);
end;
 
end.