string name;
name = TextBox1.Text;
Bitmap image = new Bitmap(200, 20);
Graphics g = Graphics.FromImage(image);
string filename=FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath("~/images/"+filename));
System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath("~/images/"+filename));
System.Drawing.Image bmp1 = img.GetThumbnailImage(30, 20, null, IntPtr.Zero);
bmp1.Save(Server.MapPath("~/images1/" + filename));
System.Drawing.Image icon = System.Drawing.Image.FromFile(Server.MapPath("~/images1/" + filename));
g.DrawImageUnscaled(icon, 0, 0);
g.FillRectangle(Brushes.LightYellow, 25, 0, 200, 20);
// g.DrawRectangle(Pens.Red, 0, 0, 299, 100);
Font font = new Font("Alba Super", 12, FontStyle.Regular);
g.DrawString(name, font, Brushes.Blue, 22, 0);
Response.ContentType = "image/gif";
image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
image.Save(Server.MapPath("~/saveimage/"+name+".jpg"));
g.Dispose();
image.Dispose();
Url: http://www.java2s.com/Tutorial/ASP.NET/0180__Development/GenerateImagepaintstringwithfontanddrawimageC.htm
No comments:
Post a Comment