We’ve been developing and improving DotNetBar for Win-Forms for last 6 years and soon we will be releasing new 7.0 release. Its a really big release with 6 completely new controls so I wanted to start a series of posts that cover all new features.

Today I’ll start with the  enhancements we made to the TextBoxX control that has been part of DotNetBar for quite some time. TextBoxX is the control that inherits from standard TextBox and adds the Office 2007 look and feel. What is special about this control is that it is not designed as most of other controls of this type. The most common thing that is done to provide the Office 2007 look and feel for text-box is to place it as child control inside of the UserControl, hide the text box border and draw the new border on user control. This approach is taken because it is the easiest to implement and requires least coding and testing.

Whats wrong with that you might ask? Well, nothing except that it is a resource hog. Instead of using one Window handle for text-box you are now using 2, one for text box and one for its parent user control. So if you have 40 text-boxes on your form, which is not uncommon, instead of 40 window handles you end up having 80.

Creating window handles is expensive. It will degrade the form loading time and it will slow down form painting. We wanted to avoid doubling the amount of window handles created for each text box so we’ve taken different approach that is far more work, but results in only single window handle per text-box.

Instead of parenting text box to user control, we inherit from the standard TextBox and process each Window message individually to provide custom borders, Office 2007 style scroll-bars and in 7.0 release custom buttons. With buttons that are part of text-box you can provide search, show dialogs, display popup menus, etc.

Below you can find couple of screenshots that show new TextBoxX custom buttons that are part of text box control. You simply enabled them using ButtonCustom and ButtonCustom2 properties. You can assign the image and text to each button. Best of all they do not consume additional windows handles and they look great. With couple of lines of code, as shown in screenshots below, you can easily popup the custom menu as well…

DotNetBar TextBox control with custom buttons

Professional looking applications made easy with DotNetBar for WinForms, Silverlight and WPF User Interface components. Click here to find out more.