Chapter Overview
The following overview describes what each chapter covers. If you have some .NET experience, feel free to skip from chapter to chapter and read everything in the order you prefer. If, however, you're relatively new to .NET development it's probably easiest to read through the book sequentially, to make sure you learn the basics before encountering more advanced topics.
Creating Usable Interfaces
User interface design is about more than just knowing how to program the latest trendy interface element-it's also about conventions, consistency, and the best way to guide a user into unfamiliar territory. In this chapter, you learn the basics of interface design theory, and the principles that support every good design.
Designing with Classes and Tiers
For several years, programming books and articles have advocated a three-layered approach to application design that rigorously separates user interface from application code. Despite this emphasis, real-world applications rarely follow these best practices, and programmers usually discover and rediscover that they are far more time-consuming and awkward than most computer writers promise. In this chapter, you learn how a modern layered design becomes dramatically easier with .NET-and how it might work for you.
Control Class Basics
This chapter delves into the details of one of .NET's most feature-rich classes: the Control. In this chapter, you learn how the Control class defines the basic features for responding to key presses and mouse movements, defining control relations, and handling Windows messages. You also learn about some of the basic System.Drawing ingredients for points, rectangles, colors, and fonts.
Classic Controls
The classic controls include basic tools for input, selection, and display that have been used since the ancient days of 16-bit Windows programming. This chapter also includes a few .NET twists, like the owner-drawn menus, date controls, and the hyperlink label. It rounds up with demonstrations of control validation and drag-and-drop techniques.
Forms
The Form class is the basis for every application window in a .NET program. To use forms effectively, you need to understand how forms interact, scroll, and take ownership of each other. This chapter explains the basics, and considers exciting new techniques like visual inheritance, Windows XP styles, and irregularly shaped forms. It also explains how to make multipaned resizable windows that work.
Modern Controls
This chapter dissects everyone's favorite Windows controls, including TreeView, ListView, ToolBar and StatusBar. As these controls are introduced, you see some innovative ways to extend them with custom classes that provide useful higher-level features or are tailored for a specific type of data.
Custom Controls
Custom control development is one of the key themes of this book, and a remarkable feature of the .NET platform. This chapter considers the basic types of controls you can create, and introduces examples like a bitmap thumbnail viewer, a progress user control, and a directory tree. It also considers advanced topics like asynchronous control programming, and custom extender providers, which allow you to develop enhancements that can be latched onto any .NET control.
Design-Time Support for Custom Controls
Creating a custom control is easy, but making it behave well in the design-time environment often takes a little extra wizardry. In this chapter, you see how custom control designers, UITypeEditors, and context-menu verbs can equip your controls for Visual Studio .NET. You also tackle different models of custom control licensing.
Data Controls
Most applications need to deal with data at some point. This chapter considers how you can integrate data into your user interfaces without creating an interface that's tightly coupled to a specific data access strategy or data source. In other words, you learn how you can create user interface code that doesn't directly refer to field names or assume that data is retrieved all at once. The solutions lead you through an exhaustive look at .NET data binding-and how to extend it-and show how you can create data-aware custom controls.
MDI Interfaces and Workspaces
MDI interfaces are a hallmark of modern application design. .NET makes MDI as easy as setting a few simple Form properties. This chapter explores some of the best design practices behind MDI development, including synchronization and document-view architecture. It also looks at how you can create floating toolbars and design dockable windows.
Dynamic User Interface
Dynamic user interface-creating controls at runtime rather than at design-time-isn't a philosophy that can help you break free of some of Visual Studio .NET's most significant limitations. In this chapter you consider ways to implement dynamic content, show an example of dynamic control creation with a vector-based drawing framework, and consider how to create a custom layout engine.
GDI+ Basics
GDI+ is .NET's next-generation painting framework. In this chapter, you explore GDI+ from the ground up. You learn how you can draw inside and outside paint event handlers, how to handle form resizing, and how to use basic ingredients like brushes and pens. You also take a look at more advanced topics, including double-buffering to eliminate flicker, hit testing with rectangles and paths, and drawing standard UI elements like focus cues and disabled images.
GDI+ Controls
This chapter puts the GDI+ platform to work with examples that show a gradient label, marquee text, and a button control from scratch. You develop a bar-graphing control, and take another look at the vector based drawing example from Chapter 11 with GDI+ owner-drawn controls.
Help and Application-Embedded Support
The final chapter of this book examines how you can weave help into your user interfaces. You'll learn basic techniques for context-sensitive help, techniques to provide task-based help, and tricks that allow you to integrate help windows into your applications. You'll also learn about one of Microsoft's best-kept secrets: the free Microsoft Agent control, which provides an animated character that can guide the user.