WinAPI: Arc - 绘制弧线

//声明:
Arc(
  DC: HDC;                                {设备环境句柄}
  X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer {四个坐标点}
): BOOL;


 
 
 
 
 

 

 

  

//举例:
procedure TForm1.FormPaint(Sender: TObject);
const
  x1 = 10;
  y1 = 10;
  x2 = 200;
  y2 = 200;
  x3 = 130;
  y3 = 200;
  x4 = 160;
  y4 = 10;
begin
  Canvas.TextOut(x1,y1, '1');
  Canvas.TextOut(x2,y2, '2');
  Canvas.TextOut(x3,y3, '3');
  Canvas.TextOut(x4,y4, '4');
  
  Arc(Canvas.Handle, x1,y1, x2,y2, x3,y3, x4,y4);
end;

 
 
 
 
 

 

 

  

//效果图:
26152934_Ed1y.png
//书上的一个例子:
procedure TForm1.FormPaint(Sender: TObject);
var
  i: Integer;
  r: TRect;
begin
  r := Self.ClientRect;
  Canvas.Pen.Width := 2;

  for i := 1 to 5 do
  begin
    Arc(Canvas.Handle,
        r.Left, r.Top,
        r.Right, r.Bottom,
        r.Right, (r.Bottom - r.Top) div 2,
        r.Left, (r.Bottom - r.Top) div 2
    );

    InflateRect(r, -2, -2);                 {缩小矩形}
    Canvas.Pen.Color := PaletteIndex(i+10); {改变颜色}
  end;
end;

 
 
 
 
 

 

 

  

//效果图:
26152934_rWuc.png

转载于:https://my.oschina.net/hermer/blog/319026

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值