How to Use HORZ1.BMP with Professional Toolkit Gauge Control

Last reviewed: June 21, 1995
Article ID: Q81459
The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows,

  versions 2.0 and 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 reference words: 1.00 2.00 3.00
KBCategory: kbprg kbcode
KBSubcategory: PrgCtrlsCus


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.