10. Controls
As you saw in Chapter 9: Components, it is possible to create specialized classes, known as components, which can be hosted on a form's nonvisual design surface. Components can be configured using Windows Forms Designer features...
Controls Defined
A control is a reusable class that derives from the System.Windows.Forms.Control base implementation (either directly or indirectly) and whose main purpose in life is to interact with users on behalf of a container, which can be e...
Using Controls
When a control such as a CheckBox is dropped onto a container, the Windows Forms Designer generates the following code to InitializeComponent:
// UsingControlsSampleForm.Designer.cs
partial class UsingControlsSampleForm {
...
Themed Controls
All common Windows controlsTextBox, CheckBox, RadioButton, and so onsupport Windows themes. A Windows theme specifies how the basic elements of the desktop UI are rendered. Modern versions of Windows, such as Windows XP...
Owner-Drawn Controls
The appearance of most of the standard controls is consistent with those exposed by the underlying operating system. Where possible, you should use these controls to ensure that your applications are equally consistent, alth...
Extending Existing Controls
Further down the spectrum of customization from owner-drawn controls are those controls that have exactly the UI you require but not the functionality you need. You can approach such situations by using a different tech...
Custom Controls
Owner-drawn and extended controls allow you to leverage the .NET Framework's control base to produce slightly customized variations with little effort. Sometimes, however, the standard controls simply don't provide a UI or an imp...
User Controls
Although one benefit of custom controls is that they allow you to create a reusable UI, the most popular form of UI reuse for a control is simple containment, as you're accustomed to using when you build custom forms using existing c...
Hosting COM Controls
As wonderful and varied as Windows Forms controls are, especially considering the burgeoning third-party Windows Forms control market, Component Object Model (COM) controls have been around a lot longer, and you may still ne...
Where Are We?
In both Chapter 9 and this chapter, we've looked at a variety of ways you can create specialized reusable classes that can be hosted directly on your forms and integrated into the Windows Forms Designer for easy configuration and rap...
С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.