基本信息
源码名称:<亲测>C# 生成带水印图片(支持9个位置生成水印)
源码大小:0.05M
文件格式:.zip
开发语言:C#
更新时间:2016-06-25
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
生成效果
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security;
using System.IO;
namespace Watermaker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
lblFloat.Text = trackBar1.Value * 10 "%";
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "图片文件(*.jpg) |*.jpg";
openFileDialog1.Multiselect = true;
openFileDialog1.RestoreDirectory = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
listBox1.DataSource = openFileDialog1.FileNames;
}
}
private void button3_Click(object sender, EventArgs e)
{
string strWaterImage = textBox1.Text.Trim();
int status = 9;
if (radioButton1.Checked)
{
status = 1;
}
else if (radioButton2.Checked)
{
status = 2;
}
else if (radioButton3.Checked)
{
status = 3;
}
else if (radioButton4.Checked)
{
status = 4;
}
else if (radioButton5.Checked)
{
status = 5;
}
else if (radioButton6.Checked)
{
status = 6;
}
else if (radioButton7.Checked)
{
status = 7;
}
else if (radioButton8.Checked)
{
status = 8;
}
else if (radioButton9.Checked)
{
status = 9;
}
if (strWaterImage.Length > 0 && listBox1.Items.Count > 0)
{
progressBar1.Visible = true;
progressBar1.Minimum = 0;
progressBar1.Maximum = listBox1.Items.Count;
progressBar1.Step = 1;
progressBar1.Show();
for (int i = 0; i < listBox1.Items.Count; i )
{
string strInPath = listBox1.Items[i].ToString();
Image imgIn = Image.FromFile(strInPath);
string strOutPath = Path.GetDirectoryName(strInPath) "\\w_" Path.GetFileName(strInPath);
WaterFactory.AddImageSignPic(imgIn, strOutPath, strWaterImage, status, 100, trackBar1.Value);
progressBar1.PerformStep();
}
listBox1.DataSource = null;
textBox1.Text = "";
progressBar1.Visible = false;
}
}
private void button2_Click(object sender, EventArgs e)
{
openFileDialog2.Filter = "图片文件(*.jpg) |*.jpg|图片文件(*.gif)|*.gif";
openFileDialog2.RestoreDirectory = true;
if (openFileDialog2.ShowDialog() == DialogResult.OK)
{
textBox1.Text = openFileDialog2.FileName;
}
}
private void trackBar1_ValueChanged(object sender, EventArgs e)
{
lblFloat.Text = trackBar1.Value * 10 "%";
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
System.Diagnostics.Process.Start("iexplore.exe","www.51aspx.com");
}
}
}