62,046
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.IO;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
public string company="";
public string nob="";
public float size = 12;
public string changetype;
public string paths;
protected void Page_Load(object sender, EventArgs e)
{
paths = Session["fname"].ToString();
company = Session["con"].ToString();
nob = Session["no"].ToString() ;
changetype = Session["ss"].ToString();
size = float.Parse(changetype);
draw();
}
public void draw()
{
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("banner.jpg"));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
graphicImage.SmoothingMode = SmoothingMode.HighQuality;
Bitmap logo = new System.Drawing.Bitmap(Server.MapPath(paths));
graphicImage.DrawImage(logo, new Rectangle(10, 15, 80, 80 * logo.Height / logo.Width));
Font fontat = new Font("黑体", size, FontStyle.Bold);
graphicImage.DrawString(company, fontat, Brushes.White, new Rectangle(105, 15, 220, 35));
graphicImage.DrawString(nob, fontat, Brushes.White, new Point(105, 50));
Response.ContentType = "image/jpeg";
Response.AddHeader("Content-Disposition", "attachment;filename=fur1.jpg");
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
graphicImage.Dispose();
bitMapImage.Dispose();
}
}