Introduction
This control is derived from CStatic
. It is bitmap-based to make it easy
for the user to alter the character set. Three sized character sets are provided
as can be seen in the example above. Features are:
- Bitmapped based for easy altering of character set.
- Single or multilined displays.
- Scrolling left, right, up or down at various speeds.
- Class is derived from
CStatic
and is easy to use.
- All colours can be very easily changed.
- Three character sizes are provided
- Optional automatic sizing of
CStatic
control
- Optional auto padding of strings with a supplied character
- Support for altering format of supplied bitmap.
Class Members
MatrixStatic::SetAutoPadding
This function pads the internal display string (set with the SetText()
function)
with a supplied character so that it equals the length of the value supplied in the
SetXCharsPerLine()
function.
void SetAutoPadding(
bool pad,
char ch = ' ');
Parameters
pad
- A C++ boolean variable. true = Strings will be automatically padded with the
given character to equal the value supplied to the class in the SetXCharsPerLine()
function. false = No auto padding will occur.
ch
- a char
variable. This parameter is optional as it defaults to a space
character. This is the character used to pad the string if the above parameter is true.
Return Value
None
MatrixStatic::GetText
This function fills a supplied buffer with the text that was set in the SetText()
function.
int GetText(
char *string,
int size);
Parameters
string
- A pointer to a buffer the requested text will be placed in to.
size
- An integer containing the length of the supplied buffer.
Return Value
Function returns an integer of the number of characters placed in the buffer.
MatrixStatic::SetDisplayColors
This function sets all three colours of the display characters in a single function
call.
void SetDisplayColors(
COLORREF bk,
COLORREF on,
COLORREF off);
Parameters
bk
- A COLORREF
variable which supplies the RGB(x, x, x)
value of the
background colour of the display.
on
- A COLORREF
variable which supplies the RGB(x, x, x)
value of the on
colour of the display.
off
- A COLORREF
variable which supplies the RGB(x, x, x)
value of the
off colour of the display.
Return Value
None
MatrixStatic::SetBkColor
This function sets the background colour of the display.
void SetBkColor(
COLORREF bk);
Parameters
bk
- A COLORREF
variable which supplies the RGB(x, x,
x) value of
the background colour of the display.
Return Value
None
MatrixStatic::SetColor
This function sets the on and off colours of the display.
void SetColor(
COLORREF off,
COLORREF on);
Parameters
on
- A COLORREF
variable which supplies the RGB(x, x, x)
value of the
on colour of the display.
off
- A COLORREF
variable which supplies the RGB(x, x, x)
value of
the off colour of the display.
Return Value
None
MatrixStatic::SetBitmapResource
This function is optional. It allows for an alternate bitmap resource to be supplied.
(See the supplied resource bitmaps which can be used as a template for new character formats.)
There are three bitmap resources supplied that the program requires. The correct one to use
is set when you call the SetSize()
function. They must have the ID's of
IDB_MATRIXLARGE
, IDB_MATRIXSMALL
and IDB_MATRIXTINY
.
If this function is used to supply a new or different bitmap, even if the format is the
same, you must also call the MatrixStatic::SetCustomCharSizes
function to supply
information about this bitmap.
void SetBitmapResource(
UINT bitmap);
Parameters
bitmap
- Resource identifier of the bitmap resource.
Return Value
None.
See Also
SetSize
which identifies the different size bitmaps supported.
SetCustomCharSizes()
which allows different format bitmaps.
MatrixStatic::SetText
This function supplies the text that is to be displayed. Once called your supplied string
can be deleted, the text is stored in a member CString
variable.
void SetText(
LPCTSTR lpszText);
Parameters
lpszText
- A 32-bit pointer to a constant character string
Return Value
None.
MatrixStatic::SetSize
This function identifies which of the three supported sized bitmaps was supplied in the
SetBitMapResource()
function.
void SetSize(
int size = SMALL);
Parameters
size
- an integer variable that identifies which of the three bitmap sizes
supported was given in the SetBitMapResource()
function. Possible values are
LARGE
, SMALL
& TINY
, which a defined within the class as
0, 1 and 2 integers respectively.
Return Value
None.
See Also
See the three supplied bitmap templates as an example of this.
SetCustomCharSizes()
which allows custom format bitmaps.
MatrixStatic::StopScroll
This function ceases the scrolling of the display.
void StopScroll();
Parameters
None.
Return Value
None.
MatrixStatic::DoScroll
This function starts the display scrolling in the supplied direction. This is not a
pixel scroll but a character scroll.
void DoScroll(
int speed,
BOOL dir);
Parameters
speed
- Speed of the scrolling in milliseconds. This is the same value you would
supply to the Windows SetTimer()
function.
dir
- Direction of scroll. Possible values are:
Single Line Display: (SetNumberOfLines
was supplied a value of 1)
LEFT or RIGHT, defined within the class as boolean 0 or 1 respectively.
Multiline Display: (SetNumberOfLines
was supplied a value greater than 1)
UP, DOWN, LEFT or RIGHT, defined within the class as 0, 1, 2 or 3 respectively.
Return Value
None.
MatrixStatic::SetCustomCharSizes
This function allows you to use custom format bitmaps. It sets the pixel sizes of
each character and the vertical and horizontal spacing.
These values are automatically filled in for the three internally supported sizes of
bitmaps.
void SetCustomCharSizes(
int width,
int height,
int xspace,
int yspace);
Parameters
width
- An integer of the width of each character in pixels.
height
- An integer of the height of each character in pixels.
xspace
- An integer of the space between each character horizontally in pixels.
yspace
- An integer of the space between each character vertically in pixels.
Return Value
None.
MatrixStatic::AdjustClientYToSize
This function allows the CStatic
object to be automatically sized vertically for
you to a given number of characters.
void AdjustClientYToSize(
int size);
Parameters
size
- number of vertical display lines you want the object sized to.
Return Value
None.
See Also
SetNumberOfLines()
SetXCharsPerLine()
SetAutoPadding()
AdjustClientXToSize
MatrixStatic::AdjustClientXToSize
This function allows the CStatic
object to be automatically sized horizontally
for you a given number of characters.
void AdjustClientXToSize(
int size);
Parameters
size
- number of characters you want the object sized to.
Return Value
None.
See Also
SetNumberOfLines()
SetXCharsPerLine()
SetAutoPadding()
AdjustClientYToSize()
MatrixStatic::SetNumberOfLines
This function sets the number of vertical display lines you want. It does not have to
equal the length of the string divided by the MaxXChars
value. This is useful for
vertical scrolling. If the string is longer than the number of characters shown in a
multiline display and vertical scrolling is enabled, the display will scroll
through the string showing all characters. An example of this is in the project example.
void SetNumberOfLines(
int max = 0);
Parameters
max
- An integer that supplies the number of lines you want on the display.
Return Value
None.
See Also
SetXCharsPerLine()
SetAutoPadding()
AdjustClientXToSize
AdjustClientYToSize
MatrixStatic::SetXCharsPerLine
This function sets the number of characters horizontally in the display. In a single line
display it sets how many characters can be seen in the display at one time. On multiline
displays it sets how many horizontal characters are to be used on each line.
For example: If you wanted three lines of ten characters each, a string of 30 characters
would be supplied in the SetText()
function. This parameter would be set to 10, and
the SetNumberOfLines()
function would be supplied with 3.
The difference between single and multiline is: Single line displays can have a string
longer than the supplied parameter and only the number of characters supplied here will be
shown. Multiline displays cannot, The next line displayed starts at the character following
the number of characters supplied here.
void SetXCharsPerLine(
int max = 0);
Parameters
None.
max
- An integer that supplies the number horizontal characters to display.
Return Value
None.
See Also
SetNumberOfLines()
SetAutoPadding()
AdjustClientXToSize()
AdjustClientYToSize()
History
V1.0 initial release 11th November 2002