How to Use HORZ1.BMP with Professional Toolkit Gauge Control

ID: Q81459


The information in this article applies to:
  • Microsoft Visual Basic Professional Edition for Windows, versions 2.0, 3.0
  • Microsoft Professional Toolkit for Microsoft Visual Basic programming system for Windows, version 1.0


SUMMARY

This article contains a program example of using the Visual Basic for Windows Gauge custom control (GAUGE.VBX) with the HORZ1.BMP bitmap file.


MORE INFORMATION

NOTE: The GAUGE.VBX custom control file can be found in the \Windows\System subdirectory. The HORZ1.BMP bitmap file can be found in the \BITMAPS\GUAGE subdirectory that was created during installation.

Example Program

  1. Run Visual Basic for Windows, or from the File menu, choose New Project (press ALT, F, N) if Visual Basic for Windows 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      Name          Property Setting
       -------------------------------------------------
    
       Timer        Timer1        Interval = 1
       Gauge        Gauge1        Picture = "Horz1.BMP"
                                  Max = 50
                                  InnerBottom = 16
                                  InnerLeft = 38
                                  InnerRight = 2
                                  InnerTop = 14
                                  ForeColor = &HFF& 
    (In Visual Basic version 1.0 for Windows, set the CtlName Property for the above objects instead of the Name property.)


  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 query words: 1.00 2.00 3.00

Keywords :
Version : WINDOWS:2.0,3.0; :1.0
Platform : WINDOWS
Issue type :


Last Reviewed: January 25, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.