至于非矩形的拷贝,一般还是运用 BitBlt 来实现的;
不过你需要首先创建区域,然后 SelectClipRgn 就OK 。
小小例子:
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Bmp :TBitmap;
FRgn :HRGN;
begin
Bmp :=TBitmap.Create;
Bmp.PixelFormat :=Image1.Picture.Bitmap.PixelFormat;
Bmp.Width :=100;
Bmp.Height :=100;
BitBlt(Bmp.Canvas.Handle,0,0,Bmp.Width,Bmp.Height,Image1.Canvas.Handle,80,80,SRCCOPY); //要拷贝的位图
FRgn :=CreateEllipticRgn(0,0,100,100);
SelectClipRgn(Image1.Canvas.Handle,FRgn);
Image1.Canvas.Draw(0,0,Bmp);
Bmp.Free;
DeleteObject(FRgn);
end;