第一种办法:
var
Bmp : TBitmap;
begin
Bmp := TBitmap.Create;
Bmp.Width := Width;
Bmp.Height := Height;
Bmp.PixelFormat := pf1Bit;
with Bmp.Canvas do begin
Brush.Color := clBlack;
Ellipse(1,1,100,100);
BMP.PixelFormat := pf16Bit;
Pen.Color := clRed;
Pen.Width := 10;
MoveTo(10,10);
LineTo(101,202);
end;
Canvas.Draw(0,0,Bmp);
Bmp.Free;
end;
第二种办法:
var
Bmp,BMP2 : TBitmap;
begin
Bmp := TBitmap.Create;
Bmp2 := TBitmap.Create;
Bmp.Width := Width;
Bmp.Height := Height;
Bmp2.Width := Width;
Bmp2.Height := Height;
Bmp.PixelFormat := pf1Bit;
with Bmp.Canvas do begin
Brush.Color := clBlack;
Ellipse(1,1,100,100);
BMP2.PixelFormat := pf16Bit;
BMP2.Canvas.Pen.Color := clRed;
BMP2.Canvas.Pen.Width := 10;
BMP.Transparent := TRUE;
BMP2.Canvas.Draw(0,0,BMP);
BMP2.Canvas.MoveTo(10,10);
BMP2.Canvas.LineTo(101,202);
end;
Canvas.Draw(0,0,Bmp2);
Bmp.Free;
BMP2.Free;
end;