ID Number: Q81459
1.00
WINDOWS
Summary:
This article contains a program example of using the Visual Basic
Professional Toolkit Gauge custom control with the HORZ1.BMP bitmap
file.
This information applies to Microsoft Professional Toolkit for
Microsoft Visual Basic programming system version 1.0 for Windows.
More Information:
Note: The GAUGE.VBX custom control file can be found in the \VBX
subdirectory created during the installation of the Visual Basic
Professional Toolkit. The HORZ1.BMP bitmap file can be found in the
Example Program
---------------
1. Run Visual Basic, or from the File menu, choose New Project (ALT,
F, N) if Visual Basic is already running. Form1 is created by
default.
2. From the File menu, choose Add File. In the Files box, select the
GAUGE.VBX custom control file. The Gauge tool will appear in the
toolbox.
3. Create the following controls for Form1:
Control CtrlName Property Setting
------- -------- ----------------
Timer Timer1 Interval = 1
Gauge Gauge1 Picture = "Horz1.BMP"
Max = 50
InnerBottom = 16
InnerLeft = 38
InnerRight = 2
InnerTop = 14
ForeColor = &HFF&
4. Add the following line to the general Declarations section:
Dim YoYo As Integer
5. Add the following code to the Form_Load event procedure:
Sub Form_Load ()
Form1.Caption = "YoYo Gauge Demo"
Gauge1.Value = Gauge1.Min
End Sub
6. Add the following code to the Timer1_Timer event procedure:
Sub Timer1_Timer ()
If Gauge1.Value = Gauge1.Max Then YoYo = -1
If Gauge1.Value = Gauge1.Min Then YoYo = 1
Gauge1.Value = Gauge1.Value + YoYo
End Sub
When run, this program example will alternately fill and empty the
gauge control's fill area, as controlled by the Timer event procedure.
Additional reference words: 1.00