Architecture and Design of Windows Forms Custom Controls

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Articles
.NET Articles

Custom Controls

© 2006 Eric White
This article—Architecture and Design of Windows Forms Custom Controls—is from Pro .NET 2.0 Graphics Programming, by Eric White. Copyright © 2006 Eric White. All rights reserved. Reproduced by permission. This article has been edited especially for C# Online.NET.  Read the book review! ProNETGraphics.jpg


Architecture and Design of Windows Forms Custom Controls

This chapter introduces the concept of the custom control—the real aim of this book. If you are reading this, you don’t need to be reminded of the importance of being able to create custom controls that offer users features that are not directly available with the predefined Windows Forms controls supplied by Microsoft.

Whether you are building a Windows Forms rich client application or an ASP.NET web application, the techniques for building components are identical. However, the techniques for building custom controls are quite a bit different. This chapter focuses on building custom controls for Windows Forms.

We will start off by reviewing some of the characteristics of custom controls and components in some detail. Then we will move on to the practical side and develop some custom controls. We will consider several aspects of custom controls:

* How to add properties to a custom control and inform Visual Studio .NET of default property values, so that the IDE can display properties in a way that makes it easy for other developers to reuse your control

* How controls should behave when they participate in the tabbing order of a form and receive or lose the focus, including how to correctly display keyboard UI cues

* How to how to generate your own events for a control

* How to derive a custom control from an existing Windows Forms control, allowing you to easily add custom functionality to standard controls

* How to build a custom control from several constituent controls, providing complex functionality that you can reuse in your applications

Once we have done all that, we will finish off by looking at some of the more theoretical considerations of control design, which you might want to consider when you are working on your own commercial controls.


Previous_Page_.gif Next_Page_.gif

Personal tools