zoukankan      html  css  js  c++  java
  • c# 绘图常用对象和方法

     //BitMap 位图,常用的方法,
         Save:主要方式有:(1)保存在图像文件里,可以指定格式[gif,bmp];(2) 保存在流中,以指定格式[gif,bmp]
            
     //graphic图像操作对象
        画图片的边框线 
          graphic.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
        画文本
           Font font = new Font("Arial", 12, (FontStyle.Bold | FontStyle.Italic));
           LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Red, Color.DarkRed, 1.2f, true);
           graphic.DrawString(checkCode, font, brush, 2, 2);//文本字符串 用刷子brush 字体font 区域Rectangle
        画图片的前景噪音点 
            for (int i = 0; i < 100; i++)
          {
             x = random.Next(image.Width);
            y = random.Next(image.Height);

            image.SetPixel(x, y, Color.FromArgb(random.Next()));
          }
       画线
          graphic.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);//线用画笔

  • 相关阅读:
    JS 数组总结
    JS 数据类型及其判断
    CSS 优先级
    正则表达式及其使用例子
    常见的图片格式
    React 箭头函数的使用
    手动搭建 react+webpack 开发环境
    JS 函数参数及其传递
    JS 中的 this 指向问题
    JS 中函数的 length 属性
  • 原文地址:https://www.cnblogs.com/wwwfj/p/3207530.html
Copyright © 2011-2022 走看看