String _FontName = Request ["fontname"]. TOSTRING ();
INT _FONTSIZE = Convert.ToinT16 (Request ["Fontsize"]);
String _Showname = Request ["str"]. TOSTRING ();
Bitmap objbitmap = null;
Graphics g = NULL;
Font stringfont = new font (_fontname, _fontsize, fontstyle.bold);
StringFormat stringFormat = new stringFormat ();
StringFormat.Formatflags = stringFormatflags.nowrap;
Try
{
Objbitmap = new bitmap (1, 1);
g = graphics.fromImage (objbitmap);
Sizef stringsize = g.measureString (_Showname, StringFont);
INT nwidth = (int) stringsize.width;
INT NHEIGHT = (int) stringsize.height;
g.dispose ();
Objbitmap.dispose ();
Objbitmap = New Bitmap (nwidth, nHEight);
g = graphics.fromImage (objbitmap);
G.FillRectangle (New Solidbrush (Color.Yellow), New Rectangle (0,0, NWIDTH, NHEIGHT);
g.TextRenderingHint = TextRenderingHint.antialias;
g.drawstring (_Showname, StringFont, New Solidbrush (Color.Black), New Pointf (0, 0), StringFormat;
Objbitmap.save (response.outputstream, imageformat.gif);
}
Catch (Exception EE)
{
Response.write (EE.TOSTRING ());
}
Finally
{
IF (NULL! = g) g.dispose ();
IF (NULL! = Objbitmap) objbitmap.dispose ();
Response.end ();
}