using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PhotoPatchUpload
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Monday, January 25, 2010
XML.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
///Asp.net源码下载专业站
namespace PanRoor
{
///
/// XML 的摘要说明
///
public class XMLX : Page
{
public XMLX()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public string CreateXML(string NoAndOff, string PicAndText, string PicPath, string WM_Text, string WM_Location, string WM_Transparence, string WM_Angle, string Font, string FontSize, string FontColor, string FontShadow, string FontForm, string mkcolor, string ShadowX, string ShadowY, string PlaceX, string PlaceY, string MinWidth, string MinHeight, string ZipWidth, string ZipHeight, string MinPath, string SavePath, string Effect, string Txtshadowtransparence, string PicVal, string Mosaic, string txtmX, string txtmY, string txtmWidth, string txtmHeight, string Cut, string txtcX, string txtcY, string txtcWidth, string txtcHeight, string Miniature,string DelPic)
{
//建一个新的空的XML文档
XmlTextWriter objXml = new XmlTextWriter(Server.MapPath("WM_Xml.xml"), null);
//格式化输出XML文档
objXml.Formatting = Formatting.Indented;
objXml.Indentation = 4;
//写入XML文档标记
objXml.WriteStartDocument();
//写入XML文档注释
objXml.WriteComment("Created XML" + Context.Timestamp);
//写入根元素
objXml.WriteStartElement("WKConfig");
//写入元素
objXml.WriteStartElement("Config");
//写入属性
objXml.WriteAttributeString("Technology", "ASP.NET 2.0");
//写入属性值
objXml.WriteAttributeString("Author", "张春根");
//写入子元素及文本值
objXml.WriteElementString("Title", "水印参数配置");
//写入子元素及文本值
objXml.WriteElementString("Version", "ImageWaterMark V2.0");
//写入元素
objXml.WriteStartElement("Parameter");
//写入子元素及文本值
objXml.WriteElementString("NoAndOff", NoAndOff);
objXml.WriteElementString("PicAndText", PicAndText);
objXml.WriteElementString("PicPath", PicPath);
objXml.WriteElementString("WM_Text", WM_Text);
objXml.WriteElementString("WM_Location", WM_Location);
objXml.WriteElementString("WM_Transparence", WM_Transparence);
objXml.WriteElementString("WM_Angle", WM_Angle);
objXml.WriteElementString("Font", Font);
objXml.WriteElementString("FontSize", FontSize);
objXml.WriteElementString("FontColor", FontColor);
objXml.WriteElementString("FontShadow", FontShadow);
objXml.WriteElementString("FontForm", FontForm);
objXml.WriteElementString("Grounding", mkcolor);
objXml.WriteElementString("ShadowX", ShadowX);
objXml.WriteElementString("ShadowY", ShadowY);
objXml.WriteElementString("PlaceX", PlaceX);
objXml.WriteElementString("PlaceY", PlaceY);
objXml.WriteElementString("MinWidth", MinWidth);
objXml.WriteElementString("MinHeight", MinHeight);
objXml.WriteElementString("ZipWidth", ZipWidth);
objXml.WriteElementString("ZipHeight", ZipHeight);
objXml.WriteElementString("MinPath", MinPath);
objXml.WriteElementString("SavePath", SavePath);
objXml.WriteElementString("Effect", Effect);
objXml.WriteElementString("Txtshadowtransparence", Txtshadowtransparence);
objXml.WriteElementString("PicVal", PicVal);
objXml.WriteElementString("Mosaic", Mosaic);
objXml.WriteElementString("txtmX", txtmX);
objXml.WriteElementString("txtmY", txtmY);
objXml.WriteElementString("txtmWidth", txtmWidth);
objXml.WriteElementString("txtmHeight", txtmHeight);
objXml.WriteElementString("Cut", Cut);
objXml.WriteElementString("txtcX", txtcX);
objXml.WriteElementString("txtcY", txtcY);
objXml.WriteElementString("txtcWidth", txtcWidth);
objXml.WriteElementString("txtcHeight", txtcHeight);
objXml.WriteElementString("Miniature", Miniature);
objXml.WriteElementString("DelPic", DelPic);
//关闭子元素、元素、根元素
objXml.WriteEndElement();
objXml.WriteEndElement();
objXml.WriteEndElement();
//清除缓存
objXml.Flush();
//关闭对象
objXml.Close();
return "";
}
public string XMLRead(string Value)
{
XmlDocument xd = new XmlDocument();
xd.Load(Server.MapPath("WM_Xml.xml"));
XmlNodeList xnl = xd.GetElementsByTagName(Value);
if (xnl.Count == 0)
return "";
else
{
XmlNode mNode = xnl[0];
return mNode.InnerText;
}
}
public void getcolor(ref DropDownList ddlfont)
{
ddlfont.Items.Clear();
System.Drawing.Text.InstalledFontCollection font;
font = new System.Drawing.Text.InstalledFontCollection();
foreach (System.Drawing.FontFamily family in font.Families)
{
ddlfont.Items.Add(family.Name);
}
}
public static string HexEncoding(System.Drawing.Color color)
{
string R, G, B;
string strHexEncoding;
R = color.R.ToString("X");
G = color.G.ToString("X");
B = color.B.ToString("X");
R = R.Length == 1 ? "0" + R : R;
G = G.Length == 1 ? "0" + G : G;
B = B.Length == 1 ? "0" + B : B;
strHexEncoding = "#" + R + G + B;
return strHexEncoding;
}
public void Messages(string Message, string href)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "");
}
public void Alert(string msg)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "");
}
}
}
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
///Asp.net源码下载专业站
namespace PanRoor
{
///
/// XML 的摘要说明
///
public class XMLX : Page
{
public XMLX()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public string CreateXML(string NoAndOff, string PicAndText, string PicPath, string WM_Text, string WM_Location, string WM_Transparence, string WM_Angle, string Font, string FontSize, string FontColor, string FontShadow, string FontForm, string mkcolor, string ShadowX, string ShadowY, string PlaceX, string PlaceY, string MinWidth, string MinHeight, string ZipWidth, string ZipHeight, string MinPath, string SavePath, string Effect, string Txtshadowtransparence, string PicVal, string Mosaic, string txtmX, string txtmY, string txtmWidth, string txtmHeight, string Cut, string txtcX, string txtcY, string txtcWidth, string txtcHeight, string Miniature,string DelPic)
{
//建一个新的空的XML文档
XmlTextWriter objXml = new XmlTextWriter(Server.MapPath("WM_Xml.xml"), null);
//格式化输出XML文档
objXml.Formatting = Formatting.Indented;
objXml.Indentation = 4;
//写入XML文档标记
objXml.WriteStartDocument();
//写入XML文档注释
objXml.WriteComment("Created XML" + Context.Timestamp);
//写入根元素
objXml.WriteStartElement("WKConfig");
//写入元素
objXml.WriteStartElement("Config");
//写入属性
objXml.WriteAttributeString("Technology", "ASP.NET 2.0");
//写入属性值
objXml.WriteAttributeString("Author", "张春根");
//写入子元素及文本值
objXml.WriteElementString("Title", "水印参数配置");
//写入子元素及文本值
objXml.WriteElementString("Version", "ImageWaterMark V2.0");
//写入元素
objXml.WriteStartElement("Parameter");
//写入子元素及文本值
objXml.WriteElementString("NoAndOff", NoAndOff);
objXml.WriteElementString("PicAndText", PicAndText);
objXml.WriteElementString("PicPath", PicPath);
objXml.WriteElementString("WM_Text", WM_Text);
objXml.WriteElementString("WM_Location", WM_Location);
objXml.WriteElementString("WM_Transparence", WM_Transparence);
objXml.WriteElementString("WM_Angle", WM_Angle);
objXml.WriteElementString("Font", Font);
objXml.WriteElementString("FontSize", FontSize);
objXml.WriteElementString("FontColor", FontColor);
objXml.WriteElementString("FontShadow", FontShadow);
objXml.WriteElementString("FontForm", FontForm);
objXml.WriteElementString("Grounding", mkcolor);
objXml.WriteElementString("ShadowX", ShadowX);
objXml.WriteElementString("ShadowY", ShadowY);
objXml.WriteElementString("PlaceX", PlaceX);
objXml.WriteElementString("PlaceY", PlaceY);
objXml.WriteElementString("MinWidth", MinWidth);
objXml.WriteElementString("MinHeight", MinHeight);
objXml.WriteElementString("ZipWidth", ZipWidth);
objXml.WriteElementString("ZipHeight", ZipHeight);
objXml.WriteElementString("MinPath", MinPath);
objXml.WriteElementString("SavePath", SavePath);
objXml.WriteElementString("Effect", Effect);
objXml.WriteElementString("Txtshadowtransparence", Txtshadowtransparence);
objXml.WriteElementString("PicVal", PicVal);
objXml.WriteElementString("Mosaic", Mosaic);
objXml.WriteElementString("txtmX", txtmX);
objXml.WriteElementString("txtmY", txtmY);
objXml.WriteElementString("txtmWidth", txtmWidth);
objXml.WriteElementString("txtmHeight", txtmHeight);
objXml.WriteElementString("Cut", Cut);
objXml.WriteElementString("txtcX", txtcX);
objXml.WriteElementString("txtcY", txtcY);
objXml.WriteElementString("txtcWidth", txtcWidth);
objXml.WriteElementString("txtcHeight", txtcHeight);
objXml.WriteElementString("Miniature", Miniature);
objXml.WriteElementString("DelPic", DelPic);
//关闭子元素、元素、根元素
objXml.WriteEndElement();
objXml.WriteEndElement();
objXml.WriteEndElement();
//清除缓存
objXml.Flush();
//关闭对象
objXml.Close();
return "";
}
public string XMLRead(string Value)
{
XmlDocument xd = new XmlDocument();
xd.Load(Server.MapPath("WM_Xml.xml"));
XmlNodeList xnl = xd.GetElementsByTagName(Value);
if (xnl.Count == 0)
return "";
else
{
XmlNode mNode = xnl[0];
return mNode.InnerText;
}
}
public void getcolor(ref DropDownList ddlfont)
{
ddlfont.Items.Clear();
System.Drawing.Text.InstalledFontCollection font;
font = new System.Drawing.Text.InstalledFontCollection();
foreach (System.Drawing.FontFamily family in font.Families)
{
ddlfont.Items.Add(family.Name);
}
}
public static string HexEncoding(System.Drawing.Color color)
{
string R, G, B;
string strHexEncoding;
R = color.R.ToString("X");
G = color.G.ToString("X");
B = color.B.ToString("X");
R = R.Length == 1 ? "0" + R : R;
G = G.Length == 1 ? "0" + G : G;
B = B.Length == 1 ? "0" + B : B;
strHexEncoding = "#" + R + G + B;
return strHexEncoding;
}
public void Messages(string Message, string href)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "");
}
public void Alert(string msg)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "");
}
}
}
view.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class view : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DropDownList1.SelectedValue)
{
case "1":
Image1.ImageUrl = "png.aspx?aa=1";
break;
case "2":
Image1.ImageUrl = "png.aspx?aa=2";
break;
case "3":
Image1.ImageUrl = "png.aspx?aa=3";
break;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
if (TextBox1.Text == Session["gif"].ToString())
Response.Write("OK,正确");
else
Response.Write("验证码不符合");
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class view : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (DropDownList1.SelectedValue)
{
case "1":
Image1.ImageUrl = "png.aspx?aa=1";
break;
case "2":
Image1.ImageUrl = "png.aspx?aa=2";
break;
case "3":
Image1.ImageUrl = "png.aspx?aa=3";
break;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
if (TextBox1.Text == Session["gif"].ToString())
Response.Write("OK,正确");
else
Response.Write("验证码不符合");
}
}
uploadimages.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//该源码下载自www.51aspx.com(51aspx.com)
namespace PanRoor
{
public partial class uploadimages : XMLX
{
PanRoorImageWaterMark wm = new PanRoorImageWaterMark();
PanRoorImageWaterMark.ImageAlign align;
PanRoorImageWaterMark.TextCSS txtcss;
string fpath, ftype, fname,dot;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void But_upload_Click(object sender, EventArgs e)
{
fname = fup_img.FileName;
fpath = fup_img.PostedFile.FileName;
ftype = fup_img.PostedFile.ContentType;
string[] type = ftype.Split('/');
string[] fn = fname.Split('.');
dot = "." + fn[1].ToString();
if (type[0].ToString() != "image")
{
Response.Write("文件格式错误!");
}
else
{
string filename = DateTime.Now.ToString("yyyyMMddHHmmssffff");
string pt = Server.MapPath("UploadFiles/") + filename + dot;
fup_img.SaveAs(pt);
fup_img.Dispose();
wm.SaveWaterMarkImagePath = Server.MapPath(XMLRead("SavePath"));
wm.SourceImagePath = pt;
wm.MiniatureImagePath = Server.MapPath(XMLRead("MinPath"));
wm.WaterMarkImagePath = Server.MapPath(XMLRead("PicPath"));
wm.WaterMarkText = XMLRead("WM_Text");
wm.WaterMarkTextFont = XMLRead("Font");
wm.WaterMarkTextSize =Convert.ToInt32(XMLRead("FontSize"));
switch (XMLRead("WM_Location"))
{
case "LeftTop":
align = PanRoorImageWaterMark.ImageAlign.LeftTop;
break;
case "LeftBottom":
align = PanRoorImageWaterMark.ImageAlign.LeftBottom;
break;
case "Center":
align = PanRoorImageWaterMark.ImageAlign.Center;
break;
case "RightTop":
align = PanRoorImageWaterMark.ImageAlign.RightTop;
break;
case "RightBottom":
align = PanRoorImageWaterMark.ImageAlign.RightBottom;
break;
case "CenterTop":
align = PanRoorImageWaterMark.ImageAlign.CenterTop;
break;
case "CenterBottom":
align = PanRoorImageWaterMark.ImageAlign.CenterBottom;
break;
case "CenterLeft":
align = PanRoorImageWaterMark.ImageAlign.CenterLeft;
break;
case "CenterRight":
align = PanRoorImageWaterMark.ImageAlign.CenterRight;
break;
}
wm.WaterMarkAlign = align;
wm.WaterMarkTextColor = XMLRead("FontColor");
wm.WaterMarkTextShadowColor = XMLRead("FontShadow");
if (XMLRead("FontForm") == "Bold")
txtcss = PanRoorImageWaterMark.TextCSS.Bold;
else if (XMLRead("FontForm") == "Underline")
txtcss = PanRoorImageWaterMark.TextCSS.Underline;
else if (XMLRead("FontForm") == "Italic")
txtcss = PanRoorImageWaterMark.TextCSS.Italic;
else if (XMLRead("FontForm") == "Strikeout")
txtcss = PanRoorImageWaterMark.TextCSS.Strikeout;
wm.WaterMarkTextCSS = txtcss;
if (XMLRead("DelPic") == "true")
wm.DelPic = true;
else
wm.DelPic = false;
//51_a_s_p_x.c_o_m
wm.WaterMarkTransparence = Convert.ToInt32(XMLRead("WM_Transparence"));
wm.WaterMarkPlaceX = Convert.ToInt32(XMLRead("PlaceX"));
wm.WaterMarkPlaceY = Convert.ToInt32(XMLRead("PlaceY"));
wm.WaterMarkImageGroundColor = XMLRead("Grounding");
wm.WaterMarkAngle = Convert.ToInt32(XMLRead("WM_Angle"));
wm.WaterMarkTextShadowDepthX = Convert.ToInt32(XMLRead("ShadowX"));
wm.WaterMarkTextShadowDepthY = Convert.ToInt32(XMLRead("ShadowY"));
wm.TxTShadowTransparence = Convert.ToInt32(XMLRead("Txtshadowtransparence"));
wm.ImageQuality = Convert.ToInt32(XMLRead("PicVal"));
PanRoorImageWaterMark.WmGetType pictype;
if (XMLRead("NoAndOff") == "false")
{
pictype = PanRoorImageWaterMark.WmGetType.None;
}
else if (XMLRead("PicAndText") == "pic")
{
pictype = PanRoorImageWaterMark.WmGetType.Pic;
}
else
{
pictype = PanRoorImageWaterMark.WmGetType.Text;
}
int wmpicwidth = Convert.ToInt32(XMLRead("ZipWidth"));
int wmpicheight = Convert.ToInt32(XMLRead("ZipHeight"));
//51_a_s_p_x.c_o_m
bool mininfo = true;
if (XMLRead("Miniature") == "false")
mininfo = false;
int minwidth = Convert.ToInt32(XMLRead("MinWidth"));
int minheight = Convert.ToInt32(XMLRead("MinHeight"));
PanRoorImageWaterMark.ConvertEffect effect=PanRoorImageWaterMark.ConvertEffect.None;
if (XMLRead("Effect") == "Monochrome")
effect = PanRoorImageWaterMark.ConvertEffect.Monochrome;
else if (XMLRead("Effect") == "Negative")
effect = PanRoorImageWaterMark.ConvertEffect.Negative;
PanRoorImageWaterMark.ImgMosaic mosaic=PanRoorImageWaterMark.ImgMosaic.OFF;
if (XMLRead("Mosaic") == "true")
mosaic = PanRoorImageWaterMark.ImgMosaic.ON;
int mosX = Convert.ToInt32(XMLRead("txtmX"));
int mosY = Convert.ToInt32(XMLRead("txtmY"));
int mosWidth = Convert.ToInt32(XMLRead("txtmWidth"));
int mosHeight = Convert.ToInt32(XMLRead("txtmHeight"));
PanRoorImageWaterMark.ImgCut imgcut=PanRoorImageWaterMark.ImgCut.OFF;
if (XMLRead("Cut") == "true")
imgcut = PanRoorImageWaterMark.ImgCut.ON;
int cutX = Convert.ToInt32(XMLRead("txtcX"));
int cutY = Convert.ToInt32(XMLRead("txtcY"));
int cutWidth = Convert.ToInt32(XMLRead("txtcWidth"));
int cutHeight = Convert.ToInt32(XMLRead("txtcHeight"));
wm.GetToWaterMarkImage(pictype, wmpicwidth, wmpicheight, mininfo, minwidth, minheight, effect, mosaic, mosX, mosY, mosWidth,mosHeight, imgcut, cutX, cutY, cutWidth, cutHeight);
Label1.Text = "";
}
}
}
}//51a_s_p_x.c_o_m
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//该源码下载自www.51aspx.com(51aspx.com)
namespace PanRoor
{
public partial class uploadimages : XMLX
{
PanRoorImageWaterMark wm = new PanRoorImageWaterMark();
PanRoorImageWaterMark.ImageAlign align;
PanRoorImageWaterMark.TextCSS txtcss;
string fpath, ftype, fname,dot;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void But_upload_Click(object sender, EventArgs e)
{
fname = fup_img.FileName;
fpath = fup_img.PostedFile.FileName;
ftype = fup_img.PostedFile.ContentType;
string[] type = ftype.Split('/');
string[] fn = fname.Split('.');
dot = "." + fn[1].ToString();
if (type[0].ToString() != "image")
{
Response.Write("文件格式错误!");
}
else
{
string filename = DateTime.Now.ToString("yyyyMMddHHmmssffff");
string pt = Server.MapPath("UploadFiles/") + filename + dot;
fup_img.SaveAs(pt);
fup_img.Dispose();
wm.SaveWaterMarkImagePath = Server.MapPath(XMLRead("SavePath"));
wm.SourceImagePath = pt;
wm.MiniatureImagePath = Server.MapPath(XMLRead("MinPath"));
wm.WaterMarkImagePath = Server.MapPath(XMLRead("PicPath"));
wm.WaterMarkText = XMLRead("WM_Text");
wm.WaterMarkTextFont = XMLRead("Font");
wm.WaterMarkTextSize =Convert.ToInt32(XMLRead("FontSize"));
switch (XMLRead("WM_Location"))
{
case "LeftTop":
align = PanRoorImageWaterMark.ImageAlign.LeftTop;
break;
case "LeftBottom":
align = PanRoorImageWaterMark.ImageAlign.LeftBottom;
break;
case "Center":
align = PanRoorImageWaterMark.ImageAlign.Center;
break;
case "RightTop":
align = PanRoorImageWaterMark.ImageAlign.RightTop;
break;
case "RightBottom":
align = PanRoorImageWaterMark.ImageAlign.RightBottom;
break;
case "CenterTop":
align = PanRoorImageWaterMark.ImageAlign.CenterTop;
break;
case "CenterBottom":
align = PanRoorImageWaterMark.ImageAlign.CenterBottom;
break;
case "CenterLeft":
align = PanRoorImageWaterMark.ImageAlign.CenterLeft;
break;
case "CenterRight":
align = PanRoorImageWaterMark.ImageAlign.CenterRight;
break;
}
wm.WaterMarkAlign = align;
wm.WaterMarkTextColor = XMLRead("FontColor");
wm.WaterMarkTextShadowColor = XMLRead("FontShadow");
if (XMLRead("FontForm") == "Bold")
txtcss = PanRoorImageWaterMark.TextCSS.Bold;
else if (XMLRead("FontForm") == "Underline")
txtcss = PanRoorImageWaterMark.TextCSS.Underline;
else if (XMLRead("FontForm") == "Italic")
txtcss = PanRoorImageWaterMark.TextCSS.Italic;
else if (XMLRead("FontForm") == "Strikeout")
txtcss = PanRoorImageWaterMark.TextCSS.Strikeout;
wm.WaterMarkTextCSS = txtcss;
if (XMLRead("DelPic") == "true")
wm.DelPic = true;
else
wm.DelPic = false;
//51_a_s_p_x.c_o_m
wm.WaterMarkTransparence = Convert.ToInt32(XMLRead("WM_Transparence"));
wm.WaterMarkPlaceX = Convert.ToInt32(XMLRead("PlaceX"));
wm.WaterMarkPlaceY = Convert.ToInt32(XMLRead("PlaceY"));
wm.WaterMarkImageGroundColor = XMLRead("Grounding");
wm.WaterMarkAngle = Convert.ToInt32(XMLRead("WM_Angle"));
wm.WaterMarkTextShadowDepthX = Convert.ToInt32(XMLRead("ShadowX"));
wm.WaterMarkTextShadowDepthY = Convert.ToInt32(XMLRead("ShadowY"));
wm.TxTShadowTransparence = Convert.ToInt32(XMLRead("Txtshadowtransparence"));
wm.ImageQuality = Convert.ToInt32(XMLRead("PicVal"));
PanRoorImageWaterMark.WmGetType pictype;
if (XMLRead("NoAndOff") == "false")
{
pictype = PanRoorImageWaterMark.WmGetType.None;
}
else if (XMLRead("PicAndText") == "pic")
{
pictype = PanRoorImageWaterMark.WmGetType.Pic;
}
else
{
pictype = PanRoorImageWaterMark.WmGetType.Text;
}
int wmpicwidth = Convert.ToInt32(XMLRead("ZipWidth"));
int wmpicheight = Convert.ToInt32(XMLRead("ZipHeight"));
//51_a_s_p_x.c_o_m
bool mininfo = true;
if (XMLRead("Miniature") == "false")
mininfo = false;
int minwidth = Convert.ToInt32(XMLRead("MinWidth"));
int minheight = Convert.ToInt32(XMLRead("MinHeight"));
PanRoorImageWaterMark.ConvertEffect effect=PanRoorImageWaterMark.ConvertEffect.None;
if (XMLRead("Effect") == "Monochrome")
effect = PanRoorImageWaterMark.ConvertEffect.Monochrome;
else if (XMLRead("Effect") == "Negative")
effect = PanRoorImageWaterMark.ConvertEffect.Negative;
PanRoorImageWaterMark.ImgMosaic mosaic=PanRoorImageWaterMark.ImgMosaic.OFF;
if (XMLRead("Mosaic") == "true")
mosaic = PanRoorImageWaterMark.ImgMosaic.ON;
int mosX = Convert.ToInt32(XMLRead("txtmX"));
int mosY = Convert.ToInt32(XMLRead("txtmY"));
int mosWidth = Convert.ToInt32(XMLRead("txtmWidth"));
int mosHeight = Convert.ToInt32(XMLRead("txtmHeight"));
PanRoorImageWaterMark.ImgCut imgcut=PanRoorImageWaterMark.ImgCut.OFF;
if (XMLRead("Cut") == "true")
imgcut = PanRoorImageWaterMark.ImgCut.ON;
int cutX = Convert.ToInt32(XMLRead("txtcX"));
int cutY = Convert.ToInt32(XMLRead("txtcY"));
int cutWidth = Convert.ToInt32(XMLRead("txtcWidth"));
int cutHeight = Convert.ToInt32(XMLRead("txtcHeight"));
wm.GetToWaterMarkImage(pictype, wmpicwidth, wmpicheight, mininfo, minwidth, minheight, effect, mosaic, mosX, mosY, mosWidth,mosHeight, imgcut, cutX, cutY, cutWidth, cutHeight);
Label1.Text = "";
}
}
}
}//51a_s_p_x.c_o_m
Config_XML.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
//该源码下载自www.51aspx.com(51aspx.com)
namespace PanRoor
{
public partial class XML : XMLX
{
XMLX bind = new XMLX();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
colorloading();
string[] FormValue = new string[] { "Bold", "Underline", "Italic", "Strikeout" };
string[] FormName = new string[] { "加粗文本", "下划线文本", "倾斜文本", "中划线文本" };
for (int i = 0; i < FormValue.Length; i++)
{
ddl_Form.Items.Add(new ListItem(FormName[i].ToString(), FormValue[i].ToString()));
}
bind.getcolor(ref ddl_font);
rb_NoAndOff.SelectedValue = bind.XMLRead("NoAndOff");
rb_PicAndText.SelectedValue = bind.XMLRead("PicAndText");
tb_picpath.Text = bind.XMLRead("PicPath");
tb_WM_Text.Text = bind.XMLRead("WM_Text");
ddl_Location.SelectedValue = bind.XMLRead("WM_Location");
tb_Transparence.Text = bind.XMLRead("WM_Transparence");
tb_Angle.Text = bind.XMLRead("WM_Angle");
ddl_font.SelectedValue = bind.XMLRead("Font");
tb_FontSize.Text = bind.XMLRead("FontSize");
tb_FontColor.Text = bind.XMLRead("FontColor");
tb_FontShadow.Text = bind.XMLRead("FontShadow");
ddl_Form.SelectedValue = bind.XMLRead("FontForm");
tb_groundcolor.Text = XMLRead("Grounding");
tb_PlaceX.Text = XMLRead("PlaceX");
tb_PlaceY.Text = XMLRead("PlaceY");
tb_ShadowX.Text = XMLRead("ShadowX");
tb_ShadowY.Text = XMLRead("ShadowY");
tb_ZipWidth.Text = XMLRead("ZipWidth");
tb_ZipHeight.Text = XMLRead("ZipHeight");
tb_MinWidth.Text = XMLRead("MinWidth");
tb_MinHeight.Text = XMLRead("MinHeight");
tb_MinPath.Text = XMLRead("MinPath");
tb_SavePath.Text = XMLRead("SavePath");
DropDownList1.SelectedValue = XMLRead("Effect");
Txtshadowtransparence.Text = XMLRead("Txtshadowtransparence");
PicVal.Text = XMLRead("PicVal");
Mosaic.SelectedValue = XMLRead("Mosaic");
txtmX.Text = XMLRead("txtmX");
txtmY.Text = XMLRead("txtmY");
txtmWidth.Text = XMLRead("txtmWidth");
txtmHeight.Text = XMLRead("txtmHeight");
Cut.SelectedValue = XMLRead("Cut");
txtcX.Text = XMLRead("txtcX");
txtcY.Text = XMLRead("txtcY");
txtcWidth.Text = XMLRead("txtcWidth");
txtcHeight.Text = XMLRead("txtcHeight");
Miniature.SelectedValue = XMLRead("Miniature");
DelPic.SelectedValue = XMLRead("DelPic");
//51_a_s_p_x.c_o_m
}
}
protected void But_Save_Click1(object sender, EventArgs e)
{
try
{
if (Convert.ToInt32(tb_Transparence.Text) > 100)
Alert("透明度不支持大于100,请重设!");
else
bind.CreateXML(rb_NoAndOff.SelectedValue, rb_PicAndText.SelectedValue, tb_picpath.Text, tb_WM_Text.Text, ddl_Location.SelectedValue, tb_Transparence.Text, tb_Angle.Text, ddl_font.SelectedValue, tb_FontSize.Text, tb_FontColor.Text, tb_FontShadow.Text, ddl_Form.SelectedValue, tb_groundcolor.Text, tb_ShadowX.Text, tb_ShadowY.Text, tb_PlaceX.Text, tb_PlaceY.Text, tb_MinWidth.Text, tb_MinHeight.Text, tb_ZipWidth.Text, tb_ZipHeight.Text, tb_MinPath.Text, tb_SavePath.Text, DropDownList1.SelectedValue,Txtshadowtransparence.Text,PicVal.Text,Mosaic.SelectedValue,txtmX.Text,txtmY.Text,txtmWidth.Text,txtmHeight.Text,Cut.SelectedValue,txtcX.Text,txtcY.Text,txtcWidth.Text,txtcHeight.Text,Miniature.SelectedValue,DelPic.SelectedValue);
colorloading();
Alert("保存成功!");
}
catch
{
Alert("保存失败!");
}
}
private void colorloading()
{
tb_groundcolor.BackColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("Grounding"));
tb_groundcolor.ForeColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("Grounding"));
tb_FontColor.BackColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontColor"));
tb_FontColor.ForeColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontColor"));
tb_FontShadow.BackColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontShadow"));
tb_FontShadow.ForeColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontShadow"));
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
//该源码下载自www.51aspx.com(51aspx.com)
namespace PanRoor
{
public partial class XML : XMLX
{
XMLX bind = new XMLX();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
colorloading();
string[] FormValue = new string[] { "Bold", "Underline", "Italic", "Strikeout" };
string[] FormName = new string[] { "加粗文本", "下划线文本", "倾斜文本", "中划线文本" };
for (int i = 0; i < FormValue.Length; i++)
{
ddl_Form.Items.Add(new ListItem(FormName[i].ToString(), FormValue[i].ToString()));
}
bind.getcolor(ref ddl_font);
rb_NoAndOff.SelectedValue = bind.XMLRead("NoAndOff");
rb_PicAndText.SelectedValue = bind.XMLRead("PicAndText");
tb_picpath.Text = bind.XMLRead("PicPath");
tb_WM_Text.Text = bind.XMLRead("WM_Text");
ddl_Location.SelectedValue = bind.XMLRead("WM_Location");
tb_Transparence.Text = bind.XMLRead("WM_Transparence");
tb_Angle.Text = bind.XMLRead("WM_Angle");
ddl_font.SelectedValue = bind.XMLRead("Font");
tb_FontSize.Text = bind.XMLRead("FontSize");
tb_FontColor.Text = bind.XMLRead("FontColor");
tb_FontShadow.Text = bind.XMLRead("FontShadow");
ddl_Form.SelectedValue = bind.XMLRead("FontForm");
tb_groundcolor.Text = XMLRead("Grounding");
tb_PlaceX.Text = XMLRead("PlaceX");
tb_PlaceY.Text = XMLRead("PlaceY");
tb_ShadowX.Text = XMLRead("ShadowX");
tb_ShadowY.Text = XMLRead("ShadowY");
tb_ZipWidth.Text = XMLRead("ZipWidth");
tb_ZipHeight.Text = XMLRead("ZipHeight");
tb_MinWidth.Text = XMLRead("MinWidth");
tb_MinHeight.Text = XMLRead("MinHeight");
tb_MinPath.Text = XMLRead("MinPath");
tb_SavePath.Text = XMLRead("SavePath");
DropDownList1.SelectedValue = XMLRead("Effect");
Txtshadowtransparence.Text = XMLRead("Txtshadowtransparence");
PicVal.Text = XMLRead("PicVal");
Mosaic.SelectedValue = XMLRead("Mosaic");
txtmX.Text = XMLRead("txtmX");
txtmY.Text = XMLRead("txtmY");
txtmWidth.Text = XMLRead("txtmWidth");
txtmHeight.Text = XMLRead("txtmHeight");
Cut.SelectedValue = XMLRead("Cut");
txtcX.Text = XMLRead("txtcX");
txtcY.Text = XMLRead("txtcY");
txtcWidth.Text = XMLRead("txtcWidth");
txtcHeight.Text = XMLRead("txtcHeight");
Miniature.SelectedValue = XMLRead("Miniature");
DelPic.SelectedValue = XMLRead("DelPic");
//51_a_s_p_x.c_o_m
}
}
protected void But_Save_Click1(object sender, EventArgs e)
{
try
{
if (Convert.ToInt32(tb_Transparence.Text) > 100)
Alert("透明度不支持大于100,请重设!");
else
bind.CreateXML(rb_NoAndOff.SelectedValue, rb_PicAndText.SelectedValue, tb_picpath.Text, tb_WM_Text.Text, ddl_Location.SelectedValue, tb_Transparence.Text, tb_Angle.Text, ddl_font.SelectedValue, tb_FontSize.Text, tb_FontColor.Text, tb_FontShadow.Text, ddl_Form.SelectedValue, tb_groundcolor.Text, tb_ShadowX.Text, tb_ShadowY.Text, tb_PlaceX.Text, tb_PlaceY.Text, tb_MinWidth.Text, tb_MinHeight.Text, tb_ZipWidth.Text, tb_ZipHeight.Text, tb_MinPath.Text, tb_SavePath.Text, DropDownList1.SelectedValue,Txtshadowtransparence.Text,PicVal.Text,Mosaic.SelectedValue,txtmX.Text,txtmY.Text,txtmWidth.Text,txtmHeight.Text,Cut.SelectedValue,txtcX.Text,txtcY.Text,txtcWidth.Text,txtcHeight.Text,Miniature.SelectedValue,DelPic.SelectedValue);
colorloading();
Alert("保存成功!");
}
catch
{
Alert("保存失败!");
}
}
private void colorloading()
{
tb_groundcolor.BackColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("Grounding"));
tb_groundcolor.ForeColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("Grounding"));
tb_FontColor.BackColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontColor"));
tb_FontColor.ForeColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontColor"));
tb_FontShadow.BackColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontShadow"));
tb_FontShadow.ForeColor = System.Drawing.ColorTranslator.FromHtml(XMLRead("FontShadow"));
}
}
}
Subscribe to:
Posts (Atom)