//几百年没碰到这东东了,麻烦你怎么再整一下吧。效果实现了。[
]
procedure TForm1.Button1Click(Sender: TObject);
var
bmp, b: TBitmap;
begin
ImageList1.Height := Image1.ClientHeight;
ImageList1.Width := Image1.ClientWidth;
bmp := TBitmap.Create;
b := TBitmap.Create;
try
with bmp do
begin
bmp.Width := Image1.ClientWidth;
bmp.Height := Image1.ClientHeight;
b.Width := bmp.Width;
b.Height := bmp.Height;
b.Canvas.Draw(0, 0, Image1.Picture.Graphic);
Canvas.Draw(0, 0, Image1.Picture.Graphic);
Canvas.Brush.Style := bsClear;
Canvas.Brush.Color := clBlack;
Canvas.FillRect(Image1.ClientRect);
Canvas.Brush.Color := clWhite;
Canvas.RoundRect(0, 0, Image1.Width, Image1.Height, 40, 40);
Mask(clWhite);
ImageList1.Add(bmp, bmp);
ImageList1.Draw(b.Canvas, 0, 0, 0, true);
ImageList1.AddMasked(b, clBlack);
ImageList1.Draw(self.Canvas, 0, 0, 1, true);
end;
finally
FreeAndNil(bmp);
FreeAndNil(b);
end;
end;