刚写完加水印的程序不久,老大又叫要改成透明水印,并且水印的字体要自适应,于是改程序如下:
//得到要写的字体的大小
float width = imgSource.Width / 2 / 13;
//GraphicsUnit.Pixel是以像素为单位
System.Drawing.Font font = new System.Drawing.Font("Arial Black", width, System.Drawing.FontStyle.Bold,GraphicsUnit.Pixel);
//new SolidBrush(Color.FromArgb(80,70,140,40))这一句就是添加透明度
graphic.DrawString("www.dgxyt.com", font, new SolidBrush(Color.FromArgb(80,70,140,40)), new System.Drawing.PointF());
于是就这样了.