标签:
1、
procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas); var bitmap :TBitMap; pt1, pt2 :TPointF; begin pt1 := TPointF.Create(0, 0); pt2 := TPointF.Create(PaintBox1.Width, PaintBox1.Width); //ShowMessage(‘yes‘); bitmap := TBitMap.Create(Trunc(PaintBox1.Width), Trunc(PaintBox1.Width)); try bitmap.Canvas.BeginScene(); // ZC: 做画图工作时,这一句必须要 bitmap.Canvas.Stroke.Kind := TBrushKind.bkSolid; bitmap.Canvas.Stroke.Color := TAlphaColorRec.Black; bitmap.Canvas.DrawLine(pt1, pt2, 1); bitmap.Canvas.EndScene; // ZC: 做画图工作时,这一句必须要 //TCanvas.CopyBitmap(bitmap, Canvas.Bitmap); //PaintBox1.Canvas.BeginScene(); // ZC: 这里,可以不执行这一句 PaintBox1.Canvas.DrawBitmap( bitmap, TRectF.Create(0, 0, PaintBox1.Width, PaintBox1.Width), TRectF.Create(0, 0, PaintBox1.Width, PaintBox1.Width), 1); //PaintBox1.Canvas.EndScene; // ZC: 这里,可以不执行这一句 finally if Assigned(bitmap) then bitmap.Free; end; end;
2、
3、
标签:
原文地址:http://www.cnblogs.com/CodeSkill/p/5646783.html