zoukankan      html  css  js  c++  java
  • 绘图

     
     
    //Canvas绘图 


    Canvas方法 CDC方法 功能
    Arc Arc 画一个椭圆弧
    Chord Chord 画一根玄。
    CopyRect 拷贝指定矩形区域中图象到指定矩形
    Draw BitBlt 拷贝位图
    Ellipse Ellipse 画椭圆
    FillRect PaintRgn 使用刷子填充一个又一个矩型
    FloodFill FloodFill 用当前刷子填充区域
    FrameRect FrameRect 画一个矩形框
    Lineto Lineto 画线到
    Moveto Moveto 移 到
    Pie Pie 画扇形
    Polygon Polygon 画多边形
    PolyLine PolyLine 画多根相连的线
    Rectangle Rectangle 画一个实心矩形
    RoundRect RoundRect 画一个圆角的矩形
    StretchDraw StretchBlt 从源图象中
                    移动图象到指定矩形
    TextWidth GetCharWidth 返回字符宽
    TextOut TextOut 在指定坐标写字
    TextRect ExtTextOut 在制定矩形中写字



    ///
    self.Canvas.Pen.Color:=clBlack;
    self.Canvas.LineTo(X,Y);//绘制直线
    self.Canvas.Ellipse(0,0,150,150);//绘制圆形
    self.Canvas.PolyLine([Point(40,10),Point(20,60), Point(70,30),Point(10,30),Point(60,60),Point(40,10)]);//五角星
    self.Canvas.Rectangle(0,0,100,100); //绘制矩形



    procedure TForm1.Button1Click(Sender: TObject);
    var //绘制弧线
      R: TRect;
    begin
      Refresh;
      R := GetClientRect; {得到当前窗口的边界}
      Canvas.Arc(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
    end;


    procedure TForm1.Button2Click(Sender: TObject);
    begin //绘制椭圆
        Refresh;
        Canvas.Brush.Color := clRed;
        Canvas.Brush.Style := bsDiagCross;
        Canvas.Ellipse(0, 0, Width, Height-50);
    end;

    procedure TForm1.Button3Click(Sender: TObject);
    var//绘制弓形
      R: TRect;
    begin
      R := GetClientRect; { Get coordinates of the current window. }
      Canvas.Chord(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
    end;


    procedure TForm1.Button4Click(Sender: TObject);
    begin //绘制三角
      Canvas.Brush.Color := clTeal;
      Canvas.Polygon([Point(10, 10), Point(30, 10),
        Point(130, 30), Point(240, 120)]);
    end;

    //
    1 改变画笔的颜色
    2 在窗体上绘制矩形
    3 直接在屏幕上绘制




  • 相关阅读:
    一对一关联映射
    hibernate 中的 lazy=”proxy” 和 lazy=”no-proxy” 的区别
    Hibernate 延迟加载和立即加载
    hibernate inverse属性的作用
    Hibernate一对多关联
    Hibernate双向多对多关联
    SQL编程
    XML(DOM解析)
    UDP模式聊天
    Thread对象的yield(),wait(),notify(),notifyall()
  • 原文地址:https://www.cnblogs.com/xe2011/p/3876050.html
Copyright © 2011-2022 走看看