Introduction
ExpandoBox is a VB.NET custom control. It works like a groupbox. You can put
controls inside it at design time; use it to keep radio button choices grouped
together, or whatever else you feel the need to. The cool thing about ExpandoBox
is that it expands and contracts. It is a great screen real estate saver. It
comes with over 20 different color schemes, and creating your own is easy.
Details
ExpandoBox has 2 different orientations: Horizontal (expands left to right) and Vertical (Expands up and down). It also has 2 different border styles, Rounded
and Rectangular. It can also be resized and dragged around a form. There are
several other UI related properties such as CanMove, CanResize, CanToggle and
ShowTitleBar. It supports Enabled and Disabled states well, too.
ExpandoBox is a great learning project. At least it was for me. I’ve developed
several controls from the UserControl class, but this was my first class that
inherits directly from Control. There are some cool GDI+ tricks, including how
to draw text at different orientations.
ExpandoBox uses some cool VB.NET/OO features that did not exist in VB prior to
.NET. There are overloaded functions, structures, private classes, and even an
example of a public class that uses a friend constructor. It uses the standard
.NET event signatures (ByVal sender As Object, e As System.EventArgs) and it’s
own EventArgs class.
Conclusion
There are some great things in the ExpandoBox for both the new and experienced
VB.NET developer to examine. The code is fairly well commented. Hope you enjoy.
Not everything cool needs to be done in C#!
As an experienced programmer, I know how hard it is to find good code sometimes. I hope my articles and samples are as good for you as they are for me. Need more good code? Email me.