基本信息
源码名称:c#给图片加水印源码(支持9个位置)
源码大小:0.04M
文件格式:.zip
开发语言:C#
更新时间:2016-02-10
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
通用水印,支持9个位置,内部封装了helper,具体看案例和demo
通用水印,支持9个位置,内部封装了helper,具体看案例和demo
public partial class WaterMarkAPI : Window { public WaterMarkAPI() { InitializeComponent(); } /// <summary> /// 文字水印调用 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { //给水印对象赋对应的值 WaterMark waterMark = new WaterMark(); waterMark.WaterMarkType = Enums.WaterMarkTypeEnum.Text; waterMark.Transparency = 0.7f; waterMark.Text = "dunitian.cnblogs.com"; waterMark.FontStyle = System.Drawing.FontStyle.Bold; waterMark.FontFamily = "Consolas"; waterMark.FontSize = 20f; waterMark.BrushesColor = System.Drawing.Brushes.YellowGreen; waterMark.WaterMarkLocation = Enums.WaterMarkLocationEnum.CenterCenter; //调用 Image successImage = WaterMarkHelper.SetWaterMark("text.png", waterMark); //保存 successImage.Save("text1.png", System.Drawing.Imaging.ImageFormat.Png); MessageBox.Show("请查看软件根目录", "成功"); } /// <summary> /// 图片水印调用 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_1(object sender, RoutedEventArgs e) { //给水印对象赋对应的值 WaterMark waterMark = new WaterMark(); waterMark.WaterMarkType = Enums.WaterMarkTypeEnum.Image; waterMark.ImgPath = "水印.png"; waterMark.WaterMarkLocation = Enums.WaterMarkLocationEnum.CenterCenter; waterMark.Transparency = 0.7f; //调用 Image successImage = WaterMarkHelper.SetWaterMark("text.png", waterMark); //保存 successImage.Save("text2.png", System.Drawing.Imaging.ImageFormat.Png); MessageBox.Show("请查看软件根目录","成功"); } }