Written by: Michael Karas
This control is a number edit control that permits editing numerical values with range checking and error indications. It also includes an automatic spinner control that permits stepping the numerical value up and down. The edit box image is scaled to the size of the user client space. The font in the edit box is user specified so that it can be customized to a look to suit the host form.
The automatic spinner button controls, which can be turned off if not needed, are setup with a number of nice features. They support timed acceleration of the step rate so that it is easy to click one step but also easy to spin the value up or down rapidly simply by holding down the mouse button. The spinner control button width is user specified and the height is automatically adjusted to the suit the size of the edit box. If the edit control height is too small to permit a usable spinner button size then spinner buttons are placed side by side to allow them to be restored to a useful size. The picture below shows the variation of the spinner button size and layout.
The range checking of the control can be set to operate in an number of ways. The chart below shows the error handling methods supported. The second picture shows how the "Symbolic" method is used to show that the entered number value is out of range.
The image below shows the Visual Basic properties box for the NumBox control. Eighteen specialized property settings, all of which are read/write at both design time and run time, provide the ability to customize the control to specific usages.
The following list describes each of these properties:
The control comes packaged with a simple test application program that permits the number edit control behavior to be manipulated and studied. The picture below shows what this test application looks like:
Click the link below to download the NumBox Edit Control source code and project files that have been packed into a ZIP archive file.
(Note regarding the download: You may incorporate all or parts of this program into your own project. Keep in mind that you get this code free and as such Carousel Design Solutions has no responsibility to you, your customers, or anyone else regarding the use of this program code. No support or warranty of any kind can be provided. All liability falls upon the user of this code and thus you must judge the suitability of this code to your application and usage).
Web Site: www.carousel-design.com