水印制做

//读取数据流图像初使化
  public System.Drawing.Image Rimg(string str, string font, int left, int up, int size,int alpha, MemoryStream fs)
  {      
   //System.Drawing.Image SImg = System.Drawing.Image.FromFile(FPath.Value);
   System.Drawing.Image SImg = System.Drawing.Image.FromStream(fs);
   Graphics GS = Graphics.FromImage(SImg);   
   System.Drawing.Brush brush = new SolidBrush(Color.FromArgb(alpha,Color.White));
   System.Drawing.Brush brush1 = new SolidBrush(Color.FromArgb(7,Color.Black)); //阴影一
   System.Drawing.Brush brush11 = new SolidBrush(Color.FromArgb(2,Color.Black));//阴影二
   Font sFont = new Font(font, size);
   
   //画阴影1
   GS.DrawString(str,sFont,brush1,left,up+1);
   GS.DrawString(str,sFont,brush1,left+1,up);
   //画阴影2
   GS.DrawString(str,sFont,brush11,left,up+2);
   GS.DrawString(str,sFont,brush11,left+2,up);
   //画实影
   GS.DrawString(str,sFont,brush,left,up);

   sFont.Dispose();
   brush1.Dispose();
   brush11.Dispose();
   brush.Dispose();
   GS.Dispose();
   //fs.Close();

   return SImg;   
  }

你可能感兴趣的:(水印)