Namespace GIF
{
Using system;
Using system. drawing;
Using system. Web. UI;
Public class mytempimage: Page
{
Public String createimage ()
{
String STR = datetime. Now. tostring ();
Bitmap image = new Bitmap (200,30 );
Graphics G = graphics. fromimage (image );
String thefullname = server. mappath ("/") + "\ nowtime.gif ";
G. Clear (color. White );
G. drawstring (STR, new font ("Courier New", 10), new solidbrush (color. Red), 20, 5 );
// There are many drawing methods for graphics to draw straight lines, curves, circles, and so on.
Image. Save (thefullname, system. Drawing. imaging. imageformat. GIF );
Return "/nowtime.gif ";
}
}
}
//////////////////////////////////////// ///
<% @ Page Language = "C #" %>
<% @ Import namespace = "wmj" %>
<Script language = "C #" runat = "server">
Void page_load (Object sender, eventargs E)
{
Mytempimage = new mytempimage ();
Img1.src = mytempimage. createimage ();
}
</SCRIPT>
<HTML>
<Head>
<! -- Automatically refresh every 10 seconds -->
<Meta http-equiv = "refresh" content = "10">
</Head>
<Body>
<Form runat = "server">
<Input type = "button" value = "manual refresh" onclick = "location. Reload ()">
</Form>
</Body>
</Html>