1、可以指定文字字体、大小和颜色(注:指定的文字在WEB服务器上需要有该字库);
2、可以加文字阴影;
3、可以指定文字的透明度;
4、可以指定背景图片或背景颜色;
5、可以指定生成的图片大小(宽度与高度);
6、可以指定文字的位置(左边距和上边距);
7、当用户设定的文字字号太大,能自动调整文字大小使之能适应生成图片的大小。
该类实现代码如下:
1using System.Drawing;
2using System.Drawing.Drawing2D;
3using System.Drawing.Imaging;
4
5namespace Ycweb.Controls.Utility
6{
7 /**//// <summary>
8 /// WaterMark
9 /// </summary>
10 public class Watermark
11 {
12 private int _width;
13 private int _height;
14 private string _fontFamily;
15 private int _fontSize;
16 private bool _adaptable;
17 private FontStyle _fontStyle;
18 private bool _shadow;
19 private string _backgroundImage;
20 private Color _bgColor;
21 &nb
| 对此文章发表了评论 |

