zoukankan      html  css  js  c++  java
  • 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;
    //效果图:

    //书上的一个例子:
    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;
    
    //效果图:

  • 相关阅读:
    模拟--北京标准时间
    DOM方法
    Document-对象属性和常用的对象方法
    struts2标签
    OGNL
    Java基础方面
    初识拦截器
    访问者模式
    备忘录模式
    门面模式
  • 原文地址:https://www.cnblogs.com/del/p/1066339.html
Copyright © 2011-2022 走看看