Viewing source for Recipe2202vb.aspx

<%@ Page language="vb" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.Drawing.Text" %>
<script runat="server">

		Public Sub Page_Load(sender as object, e as System.EventArgs )
		

			'create a new bitmap image
			Dim OutputBitmap = new Bitmap(320,200)
			Dim DrawGraphic = Graphics.FromImage(OutputBitmap)

			'blank the bitmap
			DrawGraphic.Clear(Color.Beige)

			'set smoothing
			DrawGraphic.SmoothingMode = SmoothingMode.AntiAlias
			DrawGraphic.TextRenderingHint = TextRenderingHint.AntiAlias

			'create message string
			Dim MessageString as String = System.DateTime.Now.ToString()

			'draw string on graphic
			DrawGraphic.DrawString(MessageString, _
				new Font("arial",18,FontStyle.Bold), _
				Brushes.DarkBlue, new PointF(20,20))


			' set the mime type
			Response.Clear()
			Response.ContentType="image/jpeg"

			' send the image to the viewer
			OutputBitmap.Save(Response.OutputStream, ImageFormat.Jpeg)

			' clean up
			OutputBitmap.Dispose()
			DrawGraphic.Dispose()
		
		End Sub

</script>