源程如下
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    function  GetRGN(AColor:TColor):HRGN;  
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  ABMP:TBitmap;  implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin  
   self.BorderStyle:=bsNone;  
   ABMP:=TBitMap.Create;
   ABMP.LoadFromFile('1.BMP');
   ABMP.PixelFormat:=pf24bit;
   self.Width:=ABMP.Width;
   self.Height:=ABmp.Height;
   SetWindowRGN(Handle,GetRGN(ABMP.Canvas.Pixels[1,1]),true);
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
ABMP.Free;end;procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Draw(0,0,ABMP);  end;
function  TForm1.GetRGN(AColor:Tcolor):HRGN;  
Type  
           TRGBArray=array  [0..32767,0..2]  of  Byte;
var  
           x,y:Integer;  
   p:^TRGBArray;  
           r1,r2:HRGN;  
begin  
           r1:=0;  
           for  y:=0  to  ABMP.Height-1  do  Begin  
               p:=ABMP.ScanLine[y];  
                       For  x:=0  to  ABMP.Width-1  do
           if  rgb(p[x,2],p[x,1],p[x,0])<>AColor  then  Begin
                       if  r1=0  then
                           r1:=CreateRectRgn(x,y,x+1,y+1)  
               else  Begin
                           r2:=CreateRectRgn(x,y,x+1,y+1);  
                           CombineRGN(r1,r1,r2,RGN_OR);  
                   DeleteObject(r2);  
               end;
           end;  
   End;  
   result:=r1;  
end;  procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin  
           if  Button=mbleft  then  begin  
       ReleaseCapture;  
       SendMessage(handle,  WM_NCLBUTTONDOWN,  HTCAPTION,  0);  
   end  
   else  if  button=mbright  then
               close;  
end;  
end.
出现警告
[Warning] Unit1.pas(65): Comparing signed and unsigned types - widened both operands