Back To Introduction
Tutorial 3 Slider Control
Variables GOAL: To
understand that control variables can be a pre-defined class and demonstrate
working with control variables. PREREQUISITES: Tutorial
2 Add Text Fields 1.
Open the Toolbox 2.
Drag a label to the [Design] window, rename A. Text
to “Vertical Bar” 3. Drag
another label to the [Design] window, change: A. Text
to “0” B.
BorderStyle to “Fixed3D” C. Name
to “V_Slider_Echo” D. AutoSize
to “false” Add Vertical Slider
Bar 1.
Open the Toolbox 2.
Above “Common Controls” hit the expand box next
to “All Windows Forms” 3.
Drag a VScrollBar
to the [Design] window, inside
the properties window, change: A.
Name
to “V_SLIDER_BAR” B.
LargeChange
to “1” C.
Inside these properties you can change the maximum/minimum Range of your scroll bar, default should
be 0 – 100. D. If you want to change your min/max values,
simply click on your ScrollBar in the
[Design] window, right-click and go
to properties, you’ll see the
appropriate items to change under the behavior
section. Create Service
Routine 1. Click on your
Vertical Scroll Bar in the [Design]
window 2. Go to Events and double click on the blank
box next to “Scroll” 3. Now inside the
function code block for V_Slider_Bar_Scroll(...) put one of the two: Add Horizontal Bar 1. Repeat steps for Adding
Vertical Slider Bar with the following changes: 2. Inside the Slider
Control properties window, change A. Name
to “H_Slider_Bar 3. Add a label for
the H_Slider_Bar output. A. Name
to “H_Slider_Echo” B. Text
to “0” C. AutoSize
to “false” 4. Create a Service
Routine, click on the H_Slider_Bar, go to events A. Inside Events,
double-click on the blank space next to “Scroll” 5. Now inside the
function code block for H_Slider_Bar_Scroll(...), add the following code: §
In the Visual Studio project window, click