//[0] °ü·Ã ³×ÀÓ½ºÆäÀ̽º ¼³Á¤
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace ImageCreater
{
///
/// À̹ÌÁö »ý¼º±â : ³Ñ°ÜÁ® ¿À´Â ¼ýÀÚ/¹®ÀÚ ÇÑ ±ÛÀÚ¿¡ ´ëÇÑ À̹ÌÁö »ý¼º
///
public class ImageCreater : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
//[1] Äõ¸®½ºÆ®¸µ ¹®ÀÚ¿ ¹Þ±â
string strWord = Request["Word"].ToString();
int intWidth = 16;//Convert.ToInt32(Request["Width"].ToString());
int intHeight = 16;//Convert.ToInt32(Request["Height"].ToString());
//[2] ºñÆ®¸Ê À̹ÌÁö »ý¼º
Bitmap b = new Bitmap(intWidth, intHeight);
Graphics g = Graphics.FromImage(b);
//[3] ¹è°æ»ö ÁöÁ¤
g.Clear(Color.Yellow);
//[4] ¾ØÆ¼ ¾Ù¸®¾î½Ì ¼³Á¤
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
//[5] ÅØ½ºÆ® ±×¸®±â
g.DrawString(strWord, new Font("Arial", 12, FontStyle.Bold), Brushes.DarkBlue, new PointF(1, 0));
//[6] ÄÁÅÙÃ÷ ŸÀÔ ÁöÁ¤ ¹× Àü¼Û
Response.ContentType = "image/gif";
b.Save(Response.OutputStream, ImageFormat.Gif);
//[7] °³Ã¼ ÇØÁ¦
b.Dispose();
g.Dispose();
}
#region Web Form µðÀÚÀ̳ʿ¡¼ »ý¼ºÇÑ ÄÚµå
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: ÀÌ È£ÃâÀº ASP.NET Web Form µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù.
//
InitializeComponent();
base.OnInit(e);
}
///
/// µðÀÚÀÌ³Ê Áö¿ø¿¡ ÇÊ¿äÇÑ ¸Þ¼µåÀÔ´Ï´Ù.
/// ÀÌ ¸Þ¼µåÀÇ ³»¿ëÀ» ÄÚµå ÆíÁý±â·Î ¼öÁ¤ÇÏÁö ¸¶½Ê½Ã¿À.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}