Академический Документы
Профессиональный Документы
Культура Документы
Objectives
To be able to use Horizontal and Vertical Scrollbar controls to select from ranges of
values.
To be able to use Scrollbars to manipulate other controls.
Notes
Scrollbars let users control value changes. Rather than type specific values, the user can move the
scrollbar with the mouse to specify relative positions within a range of values. There are two types
of scrollbars: Horizontal and Vertical Scrollbars. Except for their orientation, they share exactly
the same properties.
Description
Specifies the amount that the scrollbars Value property
changes when the user clicks within the scrollbars shaft
area.
Indicates the maximum number of units that the scrollbar
value represents at its highest setting. The range is from 1 to
32,767 (the default Max value)
Indicates the minimum number of units the scrollbar value
represents at its lowest setting. The range is from 1 (the
default Min value) to 32,767.
Specifies the amount that the scrollbars Value property
changes when the user clicks an arrow at either end of the
scrollbar.
Contains the units of measurement currently represented by
the position of the scrollbar.
When you place a scrollbar on a Form, set the range of values the scrollbar is to represent. Set the
Min and Max property to the lowest and highest value the scrollbar will represent, respectively.
When the user eventually clicks any arrow in the scrollbar, the Value of the scrollbar will change
(positive SmallChange when the right or up arrow is clicked; negative SmallChange when the left or
down arrow is clicked).
Lesson in Action
Lets use the ScrollBar in a simple application. In the Form below, the ScrollBar will be used to
manipulate the font size of the Label. The main task is simply to associate the Value property of
the scrollbar to the FontSize property of the Label. Thus, changing the ScrollBars Value will
subsequently change the FontSize of the Label.
4.
On your Own
1. Create a program that manipulates the position of the Label in the Form using Vertical and
Horizontal Scrollbars. Note: Make sure that the Label does not go beyond the rectangular
Shape control.
2. Modify the program you have made in the Lesson in Action section. Display the current font
size in a Label.