首页  编辑  

利用路径进行绘图

Tags: /超级猛料/Picture.图形图像编程/控件和绘图/   Date Created:

procedure TForm1.Button1Click(Sender: TObject);

var

 lb                : TLogBrush;

begin

 lb.lbStyle := BS_SOLID;

 lb.lbColor := RGB(255, 0, 0);

 lb.lbHatch := 0;

 Canvas.Pen.Handle := ExtCreatePen(PS_GEOMETRIC or PS_INSIDEFRAME or

   PS_ENDCAP_SQUARE or PS_JOIN_BEVEL, 20, lb, 0, nil);  /// 自定义的Pen

 BeginPath(Canvas.Handle);

 Canvas.MoveTo(100, 30);

 Canvas.LineTo(200, 100);

 Canvas.LineTo(300, 30);

 EndPath(Canvas.Handle);

 StrokePath(Canvas.Handle);   /// 渲染闭合的路径区域

 Canvas.Pen.Width := 1;

end;