Developing GDI+ Web Applications

In previous chapters we covered almost every aspect of drawing using Windows Forms. This chapter will introduce you to drawing on the Web and show how GDI+ can be used to write powerful graphics Web applications. From a programmer's perspective, GDI+ treats both Windows and Web applications in the same way.

This chapter covers the following topics:

  • A quick introduction to ASP.NET
  • Developing your first Web application using ASP.NET in Visual Studio .NET
  • Understanding the process of drawing on the Web
  • Creating Bitmap and Graphics objects
  • Drawing simple rectangles and other graphics objects on Web Forms
  • Drawing images on Web Forms
  • Setting the alpha value and quality of graphics objects
  • Using linear and path gradient brushes on the Web
  • Drawing line charts
  • Drawing and filling pie charts

If we want to draw a rectangle on the Web, we create a Graphics object and call its DrawRectangle method. However, getting a Graphics object for a Web page is different from getting one for a Windows Form, as we will discuss in greater detail later.

Another restriction in Web applications is the fact that a browser can display only images. If we wanted to draw a rectangle on a Web page, the rectangle would first have to be drawn and converted into an image and then sent to the browser for display.

To draw graphics shapes in a Windows Forms application, we simply call the draw or fill method, and GDI+ draws the shape on the form, as Figure 12.1 shows.

Figure 12.1. Drawing in Windows Forms

graphics/12fig01.gif

Drawing in Web Forms involves one extra step. When you call a draw or fill method, GDI+ doesn't communicate directly with the Web Forms. Instead, it allows us to save a graphics shape as an image. Later we send the image to the browser for display. This process is shown in Figure 12.2.

Figure 12.2. Drawing in Web Forms

graphics/12fig02.gif

After completing this chapter, you will be amazed by the power and flexibility of GDI+ and ASP.NET.

GDI+: The Next-Generation Graphics Interface

Your First GDI+ Application

The Graphics Class

Working with Brushes and Pens

Colors, Fonts, and Text

Rectangles and Regions

Working with Images

Advanced Imaging

Advanced 2D Graphics

Transformation

Printing

Developing GDI+ Web Applications

GDI+ Best Practices and Performance Techniques

GDI Interoperability

Miscellaneous GDI+ Examples

Appendix A. Exception Handling in .NET



GDI+ Programming with C#
GDI+ Programming with C#
ISBN: 073561265X
EAN: N/A
Year: 2003
Pages: 145

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net