• 绘图


     
     
    //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 直接在屏幕上绘制




  • 相关阅读:
    MySQL 5.7 Invalid default value for 'CREATE_TIME'报错的解决方法
    浅析mysql中exists 与 in 的使用
    mysql 索引原理
    内存溢出与内存泄漏
    java 内部类详解
    JAVA中重写equals()方法的同时要重写hashcode()方法
    Java中volatile关键字解析
    JDK1.8 HashMap源码分析
    mysql 行转列 列转行
    Java多线程(十)——线程优先级和守护线程
  • 原文地址:https://www.cnblogs.com/xe2011/p/3876050.html
Copyright © 2020-2023  润新知