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);//线用画笔

  • 相关阅读:
    MD5算法MFC实现
    asp.net2.0新特点
    file format
    C专家编程第二章学习笔记
    Bye Czech golden generation
    中间层
    学完谭C之后
    C语言学习之路
    荀子劝学篇
    C语言常用转义字符表
  • 原文地址:https://www.cnblogs.com/wwwfj/p/3207530.html
Copyright © 2011-2022 走看看