Generate a GIF picture in the web page

xiaoxiao2021-03-06  87

Author: love.net

Everyone knows that the K-line map of the stock website is the dynamically generated timing refresh PHP has the function of dynamically generating pictures.

So how do you use ASP.NET to generate a picture in the web page?

Below I want an example is a dynamic generation of a picture showing the current time

Namespace WMJ

{

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);

// Graphics class also has a lot of drawing methods to draw straight lines, curves, circles, etc.

Image.save (TheFullName, System.drawing.Imaging.imageformat.gif);

Return "/nowtime.gif";

}

}

}

///

<% @ Page language = "c #"%>

<% @ Import namespace = "wmj"%>