Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
George Omura. Lisp programing tutorial for AutoCAD customization / Using VBA to Create AutoCAD Applications - Omura, George.pdf
Скачиваний:
113
Добавлен:
02.05.2014
Размер:
883.43 Кб
Скачать

TYPES OF CONTROLS

17

Figure 99.15 The MultiPage control

The ScrollBar Control

The ScrollBar control allows you to draw a Windows scrollbar anywhere on a UserForm. Don’t confuse these with the scroll bars that can appear when a window is too small to display its entire contents. These ScrollBars are not attached to any other control. They provide a handy way for the user to select a value from a continuous range. The user can select a value from a range specified by the developer by moving a small block, called the thumb, up and down within the containing ScrollBar control.

Figure 99.16 shows both vertical and horizontal scroll bars. A ScrollBar control senses whether its height is greater than its width, and uses the information to decide which way to draw the scroll bar. You can also control this explicitly by setting the ScrollBar’s Orientation property.

Scroll bars are useful any time you need to allow the user to select a value from a continuous range. In an AutoCAD application, you might use a scroll bar to allow the user to choose a radius for a circle.

Copyright ©2001 SYBEX, Inc., Alameda, CA

www.sybex.com

18

CHAPTER NINETY-NINE • USING VBA TO CREATE AUTOCAD APPLICATIONS

Figure 99.16 The ScrollBar control

The SpinButton Control

The SpinButton control gives users a handy way to increment or decrement a value. Typically, you’ll associate a SpinButton control with a TextBox control, and use the text box to display a value that the spin button can change. Figure 99.17 shows how this interface might look.

Spin buttons are appropriate anywhere that you’d like to allow easy entry of small numeric values. The Print dialog box in many products, for example, uses spin buttons to control the number of copies to be printed.

Figure 99.17 The SpinButton control

Copyright ©2001 SYBEX, Inc., Alameda, CA

www.sybex.com

TYPES OF CONTROLS

19

The Image Control

The last of the standard tools is the Image control. Like a Label control, an Image control is purely static, a way to make your user interface look better. An Image control can display a picture on a UserForm, as shown in Figure 99.18.

Image controls are appropriate any time you’re trying to add polish to your interface and make your application appear more professional. Pick your images with care, though, and don’t let them distract from the functionality of the application.

Figure 99.18 The Image control

Controls in the Sample Application

The sample application you will build in this chapter will allow us to select any line in an AutoCAD drawing, set its color, and change its endpoints. This UserForm features CommandButton, Frame, TextBox, Label, and ListBox controls. Figure 99.19 shows the completed user interface of this UserForm in Design mode.

Figure 99.19 Designing the user interface

Copyright ©2001 SYBEX, Inc., Alameda, CA

www.sybex.com