Just as you can design custom classes, you can use Visual Studio to design custom controls. The process is very similar, in the sense that custom controls have properties, methods, and events, which are implemented with code that's identical to the … [Read more...] about Designing Windows Controls
Building Custom Windows Controls
Enhancing Existing Controls
The simplest type of custom Windows control you can build is one that enhances the functionality of an existing control. Fortunately, they're the most common types of custom controls, and many developers have their own collections of "enhanced" … [Read more...] about Enhancing Existing Controls
Adding Functionality to Your Custom Control
As you can see, it's quite trivial to create a new custom control by inheriting any of the built-in Windows controls. Of course, what good is a control that's identical to an existing one? Let's add some extra functionality to our custom TextBox … [Read more...] about Adding Functionality to Your Custom Control
Building Compound Controls
A compound control provides a visible interface that consists of multiple Windows controls. The controls that make up a compound control are known as constituent controls. As a result, this type of control doesn't inherit the functionality of any … [Read more...] about Building Compound Controls
Building User-Drawn Controls
This is the most complicated but most flexible type of control. A user-drawn control consists of a UserControl object with no constituent controls. You are responsible for updating the control's visible area with the appropriate code, which must … [Read more...] about Building User-Drawn Controls
Raising Custom Events
When you select the custom control in the Objects drop-down list of the editor and expand the list of events for this control, you'll see all the events fired by UserControl. Let's add a custom event for our control. To demonstrate how to raise … [Read more...] about Raising Custom Events
Designing Irregularly Shaped Controls
The UserControl object has a rectangular shape by default. However, a custom control need not be rectangular. It’s possible to create irregularly shaped forms, too, but unlike irregularly shaped controls, an irregularly shaped form is still quite … [Read more...] about Designing Irregularly Shaped Controls
Customizing List Controls
In this section, I’ll show you how to customize the list controls (such as the ListBox, ComboBox, and TreeView controls). You won’t build new custom controls in this section; actually, you’ll hook custom code into certain events of a control to take … [Read more...] about Customizing List Controls