[C #] Generate a GIF picture in the web page

xiaoxiao2021-03-06  14

Everyone knows that the K-line map of the stock website is a dynamically generated timing refresh PHP has a dynamically generated image function that uses 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.drawstring (Str, New font) "Courier New", 10), New Solidbrush (Color.red), 20, 5); // Graphics class There are still many drawings to draw straight lines, curves, circles, etc. Image.Save (theFullname, System.drawing.Imaging.Imaging .Imageformat.gif); return "/nowtime.gif";}}}

///

<% @ Page language = "C #"%> <% @ Import namespace = "Wmj"%>