O'Reilly logo

Graphics Programming with GDI+ by Mahesh Chand

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.4. Drawing Images on the Web

The process of drawing images on the Web is slightly different from that of drawing images on Windows Forms. In Windows Forms we create a Bitmap object and call the Graphics.DrawImage method. Drawing on the Web requires a Graphics object. The Bitmap.Save method takes care of the rest, as discussed earlier.

To test this, let’s create a Web application using Visual Studio .NET and add the code given in Listing 12.5 on the page-load event. This code views an image on the browser. First we create a Bitmap object from an image, then we create a Graphics object from the image, and then we call the Save method of Bitmap.

Listing 12.5. Drawing images on the Web
 // Create a Bitmap object from a file Bitmap curBitmap = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required