zoukankan      html  css  js  c++  java
  • GDI+

    1.GDI+命名空间:System.Drawng.  System.Drawng.Text. System.Printing. System.Drawing.Imaging. System.Draming.Drawing2D。 System.Drawing.Design

    一       .Graphics(画板)对象,

          创建graphics的方法:1.利用窗体或控件的Paint事件的参数PaintEventArgs:

    Private void Form1_Paint(object sender,System.EventArgs e)

    {

          Graphics g=e.Graphics;

    }

    2.  s使用窗体或控件的CreateGraphics的方法,用于对想一存在的情况下:

      Graphics g;

      g=this.CreateGraphics();

    3.LinearGradientBrush(颜色渐变画刷)

        linearGradientBrush ff=new LinearGradientBrush(new Point(),new Point(),Color.red,Color,Blue)

    4.Font 建立之后不能修改 必须重新建立新的对象。

       常用属性:  Bold  Italic  Regular,Strikeout,Underline

    三。画椭圆

                 Graphics g = e.Graphics;
                 Pen p = new Pen(Color.Red, 20);
                 g.DrawEllipse(p, 1, 2, 50, 30);
                 Rectangle r = new Rectangle(52, 25, 136, 40);
                 g.DrawEllipse(p, r);

                 画多边形:

      Graphics g = e.Graphics;
                Pen p = new Pen(Color.Red, 20);
                g.DrawEllipse(p, 1, 2, 50, 30);
                 Rectangle r = new Rectangle(52, 25, 136, 40);
                 g.DrawEllipse(p, r);
                 Point p1 = new Point(50, 50);
                 Point p2 = new Point(15, 50);

                 Point p3 = new Point(150, 50);

                 Point p4 = new Point(120, 50);
                 Point p5 = new Point(25, 50);
                 Point p6 = new Point(50, 65);
                 Point[] curvePont = {p1,p2,p3,p4,p5 };
                 g.DrawPolygon(p, curvePont);

    二。Pen对象的创建的方式

      1, Pen p1=new Pen(Color);

    2.Pen p2=new Pen(Brush);

    3Pen p3=new Pen(Brush,float);带宽度刷子

    4.Pen p4=new Pen(Color,Red);颜色和像

    三。Brush对象(画刷)  用来填充图形,是抽象类,不能实例化,只能使用它派生

    1.  SolidBrush(单色画刷)

           SolidBrush ff=new SolidBrush(Color.red)

           2.HatchBrush(阴影画刷)

                 HatchStyle ff = new HatchStyle(HatchStyle.Cross, Color.Blue, Color.Red);

  • 相关阅读:
    容器适配器
    告别格式工厂的视频格式转换方法(mac版 命令行)
    配置CentOS7的网络为固定IP
    Java 多线程学习--线程池
    Java多线程学习--[转]
    使用VLC接收RTP流并时时播放(RTP流是pcma包)
    [转载好文]Linux下编写 makefile 详细教程
    [转载]简明 VIM 练级攻略
    linux删除不了文件, 修改文件属性也删除不了的一个解决思路
    SHELL脚本“syntax error: unexpected end of file”解决方案[半原创]
  • 原文地址:https://www.cnblogs.com/czsl/p/2752837.html
Copyright © 2011-2022 走看看