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.3. Drawing Simple Graphics

As we discussed in the previous section, from the programming perspective, drawing on the Web is the same as drawing in Windows Forms, except for a few small differences. Drawing on the Web is often called “drawing on the fly” (or “graphics on the fly”). The code in Listing 12.4 draws various graphics objects, including lines, text, rectangles, and an ellipse. We create various pens, brushes, and a 300×300 bitmap. Then we create a Graphics object from this bitmap by calling Graphics.FromImage. Once we have a Graphics object, we can call its methods to draw and fill graphics shapes.

After creating the Graphics object, we set its smoothing mode to AntiAlias, create font and size objects, and call the DrawString, ...

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