hi all,
i have completed code to overlap images but what i want is with these overlapped image text in textbox should also overlap on image so below is my code where we have to implement it i cant understand so any body helpme or give my any examples
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Data;
using System.Data.SqlClient;
public partial class upload_site : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string CS = "Data Source=HOME;Initial Catalog=Registration;Integrated Security=True";
SqlConnection con = new SqlConnection(CS);
SqlCommand cmd = new SqlCommand();
string impath = TextBox2.Text+".png";
string filename = FileUpload1.FileName;
string pc = @"~\Upload\" + filename.Trim();
FileUpload1.PostedFile.SaveAs(Server.MapPath(@"~\Upload\" + filename.Trim()));
cmd = new SqlCommand("insert into imagepath(ID,ImageName,CurrentDate,OldImagePath,newimagepath)values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + pc + "','"+impath+"')", con);
cmd.CommandType = CommandType.Text;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
lblStatus.Text = " Uploaded Successfully ";
ChangeBackground(filename, pc);
}
private void ChangeBackground(string filename, string pc)
{
System.Drawing.Image imageBackground = System.Drawing.Image.FromFile(@"C:\temp\images.jpg");
System.Drawing.Image imageOverlay = System.Drawing.Image.FromFile(@"C:\Users\admin\Documents\Visual Studio 2012\WebSites\uploadsite\Upload\" + filename.Trim() + "");
System.Drawing.Image img = new Bitmap(imageBackground.Width, imageBackground.Height);
using (Graphics gr = Graphics.FromImage(img))
{
gr.DrawImage(imageBackground, new Point(0, 0));
gr.DrawImage(imageOverlay, new Point(0, 0));
}
img.Save(@"C:\Users\admin\Documents\Visual Studio 2012\WebSites\uploadsite\Upload\" + TextBox2.Text + ".png", ImageFormat.Png);
img.Save(@"C:\temp\" + TextBox2.Text + ".jpeg", ImageFormat.Jpeg);
Label6.Text = "scucess";
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("separate.aspx");
}
}