home account info subscribe login search FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Advanced Visual Basic Techniques
(Publisher: John Wiley & Sons, Inc.)
Author(s): Rod Stephens
ISBN: 0471188816
Publication Date: 06/01/97

Search this book:
 
Previous Table of Contents Next


Chapter 16
Histogram

ActiveX controls can be used in almost the same ways as any other control. In particular, an ActiveX control can be used to create other ActiveX controls.

This chapter describes a histogram control built using the gauge control described in Chapter 15. The first section in the chapter, “Using Histogram,” describes how the control works from the end user’s point of view. It explains the control’s run-time behavior and the means by which the user can interact with the control.

The next section, “Programming with Histogram,” describes the control’s features from an application designer’s point of view. It explains the properties and events a client application can use to manage the control.

The “Key Techniques” section briefly outlines the main tasks the control performs to support both the application developer at design time and the end user at run time. The rest of the chapter describes the histogram control’s internals and explains how the control handles these key tasks.

Using Histogram

The histogram control displays a series of data values using gauge controls. A scroll bar allows the user to move through the values if there are more data values than gauges. If the control’s Enabled property is set to true, the user can also modify the data using the gauges.

The project group HistTest.GRP in the Ch16 directory includes the test program project HistTest.VPJ. This program displays a single form containing a histogram control. Figure 16.1 shows the HistTest program displaying test data.

Programming Histogram

The histogram control is designed primarily for use with gauge controls of the tic gauge style. For that reason, histogram supports the TicWidth property used by tic gauge controls. This property and several others are delegated to the gauge controls contained in the histogram. Table 16.1 lists properties delegated to the gauges. Table 16.2 lists the other properties supported by the histogram control.


FIGURE 16.1  Test program HistTest.

The histogram control’s NumBars property indicates the number of bar gauges the control should display. The control automatically calculates the width it needs to display that number of gauges with a reasonable separation between them.

Table 16.1 Histogram Properties Delegated to the Gauge Controls
Property Type Meaning
BarBackColor OLE_COLOR Background color for gauges
BarForeColor OLE_COLOR Foreground color for gauges
Enabled Boolean Allows the user to change gauge values
Max Long Maximum value displayed by gauges
Min Long Minimum value displayed by gauges
Style HistStyle The gauge style. May be one of:
styleBar
styleDial
stylePic
styleTic
styleWid
TicWidth Long Width of gauge tic marks

Table 16.2 Histogram Properties That Are Not Delegated
Property Type Meaning
BackColor OLE_COLOR Background color of the histogram control
NumBars Integer Number of gauges
NumValues Integer Number of data values
Value Long A single data value


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-1999 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.