Summary


This chapter covered the area of drawing to a display device, where the drawing is done by your code rather than by some predefined control or dialog box - the realm of GDI+. GDI+ is a powerful tool, and there are many .NET base classes available to help you draw to a device. You’ve seen that the process of drawing is actually relatively simple - in most cases you can draw text or sophisticated figures or display images with just a couple of C# statements. However, managing your drawing - the behind-the-scenes work involving working out what to draw, where to draw it, and what does or doesn’t need repainting in any given situation - is far more complex and requires careful algorithm design. For this reason, it is also important to have a good understanding of how GDI+ works, and what actions Windows takes in order to get something drawn. In particular, because of the architecture of Windows, it is important that, where possible, drawing should be done by invalidating areas of the window and relying on Windows to respond by issuing a Paint event.

Many more .NET classes can be used for drawing than there is space to cover in this chapter. However, if you’ve worked through it and understood the principles involved in drawing, you’ll be in an excellent position to explore them by looking at their lists of methods in the SDK documentation and instantiating instances of them to see what they do. In the end, drawing, like almost any other aspect of programming, requires logic, careful thought, and clear algorithms if you want to go beyond the standard controls. Your software will benefit in both user-friendliness and visual appearance if it is well thought out. Many applications out there rely entirely on controls for their user interface. Although this can be effective, such applications very quickly end up resembling each other. By adding some GDI+ code to do some custom drawing you can mark out your software as distinct and make it appear more original, which can only help increase your sales!




Professional C# 2005 with .NET 3.0
Professional C# 2005 with .NET 3.0
ISBN: 470124725
EAN: N/A
Year: 2007
Pages: 427

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