|
PegLinearScale |
|
|
|
| ||||||||||||||||
|
|
See Also |
Styles |
The PegLinearScale class supports
the following style flags:
FF_NONE | No frame. |
FF_THIN | Thin frame. |
FF_THICK | Thick 3D frame. |
FF_RAISED | Raised 3D frame. |
FF_RECESSED | Recessed 3D frame. |
SS_TICMARKS |
If this style flag is set, the scale will be drawn with tick marks at the defined intervals. The tick marks will be drawn along the side of the scale opposite to the needle's line of travel. |
SS_FACELEFT |
This style flag only applies if the scale is mounted vertically. If this style flag is set, the needle will travel along the right side of the scale and face (point) to the left. If this style flag is reset, the needle will travel along the left side of the scale and face to the right. |
SS_FACETOP |
This style flag only applies if the scale is mounted horizontally. If this style flag is set, the needle will travel along the bottom edge of the scale and face (point) upwards. If this style flag is reset, the needle will travel along the top edge of the scale and face downwards. |
SS_BOTTOMTOTOP |
This style flag only applies if the scale is mounted vertically. If this style flag is set, the minimum value will be pegged to the bottom extreme of the scale's line of travel. If this style flag is reset, the minimum value will be pegged to the top extreme of the scale's line of travel. |
SS_LEFTTORIGHT |
This style flag only applies if the scale is mounted horizontally. If this style flag is set, the minimum value will be pegged to the left extreme of the scale's line of travel. If this style flag is reset, the minimum value will be pegged to the right extreme of the scale's line of travel. |
SS_ORIENTVERT |
If this style flag is set, the scale will be mounted vertically so that the scale needle moves up and down. If this style flag is reset, the scale will be mounted horizontally so that the scale needle moves left and right. |
SS_THINNEEDLE |
If this style flag is set, the scale needle will be drawn as a thin single line, 1 pixel wide. |
SS_THICKNEEDLE |
If this style flag is set, the scale needle will be drawn as a thick single line, 3 pixels wide. |
SS_POLYNEEDLE |
If this style flag is set, the scale needle will be drawn as a filled polygon. |
SS_STANDARDSTYLE |
This style flag mask selects the following styles which are commonly
used for scales:SS_FACELEFT | SS_BOTTOMTOTOP |
SS_ORIENTVERT | SS_TICMARKS |
SS_POLYNEEDLE.Note that derived classes may only support a subset of these style flags. For example, the linear bitmap scale simply ignores the SS_TICMARKS
style flag since tick marks, if needed, can be provided by the bitmap image
used for the scale face. |
AF_TRANSPARENT |
If this style flag is set, the background color will be that of the scale's parent object. |
|
| |
| Top of page |
Members |
Constructors:
|
| |
|
|
PegLinearScale(const PegRect &Rect,
|
LONG lMinValue, LONG lMaxValue,
| |
LONG lTicFreq = 0,
| |
WORD wStyle = SS_STANDARDSTYLE | FF_RAISED)
| |
|
|
PegLinearScale(SIGNED iLeft, SIGNED iTop,
|
LONG lMinValue, LONG lMaxValue,
| |
LONG lTicFreq = 0,
| |
WORD wStyle = SS_STANDARDSTYLE | FF_RAISED)
| |
The first constructor creates a linear scale
in the rectangle specified by parameter Rect.
The second constructor creates a linear scale
with its top left corner located at (iLeft,iTop).
By default, an object created in this fashion will have a
width of 100 pixels and a height of 150 pixels.
For both constructors, the following parameters are provided.
Values for the measured variable which the scale represents
are restricted to the range lMinValue to lMaxValue.
The minimum measured value is always pegged directly to one end of the scale's line of travel as specified by the scale's style flags. The maximum measured value maps directly to the other end of the line of travel. The needle then travels linearly from its minimum end to its maximum end as the measured value goes from its minimum value to its maximum value.
Parameter lTicFreq specifies the measurement interval at which
tick marks will be drawn on the scale's face.
The interval lTicFreq is specified in the same units as the measured
variable which the scale represents. The ticks will be drawn at intervals
along the needle's line of travel. The interval between tick marks will
represent lTicFreq measurement units.
Of course, tick marks are only drawn if the object's
SS_TICMARKS style flag is set.
The frame style and scale characteristics will be governed by the style flags
provided by parameter wStyle.
Public Functions:
|
| |
|
|
virtual void Draw(void)
|
The PegLinearScale class overrides the
Draw() function to draw the scale face,
the optional tick marks, the travel line and the scale needle to reflect the
current value of the variable which the scale represents.
|
| |
|
|
LONG GetTicFreq(void) const
|
|
|
void SetTicFreq(LONG lFreq)
|
These inline functions get or set
the measurement interval at which tick marks will be drawn.
The interval lFreq is specified in the same units as the measured
variable which the scale represents. The ticks will be drawn at intervals
along the needle's line of travel. The interval between tick marks will
represent lFreq measurement units.
Of course, tick marks are only drawn if the object's
SS_TICMARKS style flag is set.
|
| |
| Top of page |
Examples |
The following example illustrates several linear scales derived from the
PegLinearScale class and drawn within a decorated
window.

The following code fragment generated the PegLinearScale
object in the top left corner of the above illustration.
PegLinearScale *mpScale1;
:
:
PegRect WinRect;
WinRect.Set(50, 50, 100, 200);
mpScale1 = new PegLinearScale(WinRect,
0, 100, 10,
AF_TRANSPARENT | SS_STANDARDSTYLE);
mpScale1->SetValue(68, FALSE);
Add(mpScale1);
|
Top of page |
|
|
|
|
| Copyright © 2000-2003 |