Welcome
Contents of ctText

  The ctText is an enhanced text label (static text) control.

This control offers many enhancements over the regular static text control including the ability to display the text at any angle, display the text with a shadowed, three dimensional appearance, and to combine a bitmap image with the text.

The ctText control supports simple data binding through the Caption property.

File Names

Control File 	: CTTEXT.OCX

License File 	: ctText.lic

Class Name

CCtTextCtrl

See Also :

Simulating a Transparent Effect

Events

Properties

ctText © 2001 Gamesman Inc. / DBI Technologies Inc.


Events

ctText Event	Occurs
Click	Standard Event
DblClick	Standard Event
MouseDown	Standard Event
MouseMove	Standard Event
MouseOn	Occurs when the mouse initially moves over the control.
MouseUp	Standard Event


Properties

ctText Property	Data Type	Description
Alignment	integer (enumerated)	Specifies the horizontal alignment for the control. Valid values include... • 0 - Left Justified • 1 - Right Justified • 2 - Center
BackColor	long	Specifies the color used to paint the background of the control.
BackImage	Picture	Specifies the image used to paint the background of the control.
BorderColor	long	Specifies the color used to paint the control border.
BorderType	integer (enumerated)	Specifies the type of border to place around the control. Valid values include ... • 0 - Regular • 1 - None • 2 - Raised • 3 - Lowered • 4 - Drop Shadow • 5 - Inset
Caption	string	Specifies the text to be displayed within the control.
CheckMouseOver	boolean	Specifies whether to change the state of the control when the mouse moves over it.
Font	Font	Specifies the font used for the text within the control.
FontBold	boolean	Specifies whether the Font property is bold or not.
FontItalic	boolean	Specifies whether the Font property is italic or not.
FontOver	Font	Specifies the font used for the text when the mouse moves over the control.
FontSize	float	Specifies size of the Font property.
FontUnderline	boolean	Specifies whether the Font property is underline or not.
ForeColor	long	Specifies the color used to paint text within the control.
ForeColorOver	long	Specifies the color used to paint the text when the mouse moves over the control.
ImageXOffset	integer	Specifies the horizontal offset used to calculate the starting position of the BackImage property.
ImageYOffset	integer	Specifies the vertical offset used to calculate the starting position of the BackImage property.
MouseIcon	Picture	Specifies the custom image used for the cursor when the mouse moves over the control.
MousePointer	integer (enumerated)	Specifies the mouse pointer to be used when the mouse is passing over the control.
Picture	Picture	Specifies the picture to be used in the background of the control.
PicPosition	integer (enumerated)	Specifies the position of the bitmap image within the control. Valid values include ... • 0 - Center  • 1 - Top Left  • 2 - Top Center  • 3 - Top Right  • 4 - Middle Left  • 5 - Middle Right  • 6 - Bottom Left • 7 - Bottom Center  • 8 - Bottom Right  • 9 - Stretch to Fill  • 10 - Tile  • 11 - Hide
ShadowColor	long	Specifies the color used to paint the drop shadow in a border type.
SingleLine	boolean	Specifies whether or not the text will be displayed on multiple lines, or a single line.
TextAngle	integer	Specifies the angle of which the text is to be displayed.
TextPosition	integer (enumerated)	Specifies the position of the text within the control.  Valid values include ... • 0 - Top • 1 - Bottom • 2 - Center
TextXOffset	integer	Specifies the horizontal offset used for the calculated position of the text in the control.
TextYOffset	integer	Specifies the vertical offset used for the calculated position of the text in the control.
ThreeDColor	long	Specifies the color used the paint the shadowed or three dimensional text.
ThreeDText	boolean	Specifies whether or not the text will be displayed in a three dimensional sort of appearance ( with a shadow ).
WordWrap	boolean	Specifies whether or not the text will automatically be wrapped if the text is longer than the length of the control.


Simulating a Transparent Effect

While this control does not directly support transparency, it does contain the necessary properties required to simulate transparency. True transparency occurs when an image behind the control remains visible even though a control sits on top of it.

In this case, we are assuming that we are using an image assigned to a form and that we want this image to become part of the background of the control. To do this, we assign the same image as that assigned to the form to the BackImage property of the control. You then adjust the ImageXOffset and ImageYOffset properties so that image in the control lines up with the image assigned to host form. This can either be done at design time or at run time. For instance..

    Private Sub Form_Load()

        ctText.BackImage = Form1.Picture

        ctText.ImageXOffset = ctText.Left / Screen.TwipsPerPixelX

        ctText.ImageYOffset = ctText.Top / Screen.TwipsPerPixelY

    End Sub


Alignment
Alignment Property

Description

Specifies the horizontal alignment for the control. Valid values include...

•	0 - Left Justified	: Left justified text

•	1 - Right Justified	: Right justified text

•	2 - Center	: Centered text

Syntax

[form.]ctText.Alignment [ = setting% ]

Data Type

Integer ( enumerated )

Example

ctText.Alignment = 2


BackColor
BackColor Property

Description

Specifies the background color of the control. If a bitmap is used for the background, it will override this property.

Syntax

[form.]ctText.BackColor [ = color& ]

Data Type

Long ( OLE_COLOR )

Example

ctText.BackColor = RGB( 128, 128, 128 )


BackImage
BackImage Property

Description

Specifies the image used to paint the background of the control. If a back image is supplied, the background color will not be used.

If the size of the image is smaller than the area of the control, the image will be tiled so that it covers the entire area of the control.

In order to set the picture of the control, it must be either set using the picture property page of the control, the property table of the host language (if available), or by assigning a picture from another control to this one.

Syntax

[form.]ctText.BackImage [ = Picture ]

Data Type

Picture

Example

ctText.BackImage = OLE_Object.Picture


BorderColor
BorderColor Property

Description

Specifies the color of the border painted around the control.

Syntax

[form.]ctText.BorderColor [ = color& ]

Data Type

Long ( OLE_COLOR )

Example

ctText.BorderColor = RGB( 128, 128, 128 )


BorderType
BorderType Property

Description

Specifies the type of border to place around the control. Valid values include ...

•	0 - Regular	: Regular border

•	1 - None	: No border

•	2 - Raised	: Raised 3D border

•	3 - Lowered	: Lowered 3D border

•	4 - Drop Shadow	: Regular border with a shadow

•	5 - Inset      	: Inset border

Syntax

[form.]ctText.BorderType [ = setting% ]

Data Type

Integer ( enumerated )

Example

ctText.BorderType = 2


Caption
Caption Property

Description

Specifies the text to be displayed within the control.

Syntax

[form.]ctText.Caption [ = string% ]

Data Type

String

Notes

If supported by the host language, this property can be bound to a database.

Example

ctText.Caption = "Printer"


CheckMouseOver
CheckMouseOver Property

Description

Specifies whether to change the state of the control when the mouse moves over it.

Syntax

[form.]ctText.CheckMouseOver [ = { True | False } ]

Data Type

Boolean

Example

ctText.CheckMouseOver = TRUE


Font
Font Property

Description

Specifies the font used for the text within the control.

In order to set the font of the control, it must be either set using the font property page of the control, the property table of the host language ( if available ), or by assigning a font from another control with the same font type to this one.

Syntax

[form.]ctText.Font [ = Font ]

Data Type

Font

Example

ctText.Font = lbl_Text.Font


FontBold
FontBold Property

Description

Specifies whether the Font property is bold or not.

Syntax

[form.]ctText.FontBold [ = { True | False } ]

Data Type

Boolean

Example

ctText.FontBold = TRUE


FontItalic
FontItalic Property

Description

Specifies whether the Font property is italic or not.

Syntax

[form.]ctText.FontItalic [ = { True | False } ]

Data Type

Boolean

Example

ctText.FontItalic = TRUE


FontOver
FontOver Property

Description

Specifies the font used for the text when the mouse moves over the control. This property has no effect unless the CheckMouseOver property is set to a value of True.

In order to set the font of the control, it must be either set using the font property page of the control, the property table of the host language ( if available ), or by assigning a font from another control with the same font type to this one.

Syntax

[form.]ctText.FontOver [ = Font ]

Data Type

Font

Example

ctText.FontOver = lbl_Text.Font


FontSize
FontSize Property

Description

Specifies size of the Font property.

Syntax

[form.]ctText.FontSize [ = setting% ]

Data Type

Float

Example

ctText.FontSize = 12


FontUnderline
FontUnderline Property

Description

Specifies whether the Font property is underline or not.

Syntax

[form.]ctText.FontUnderline [ = { True | False } ]

Data Type

Boolean

Example

ctText.FontUnderline = TRUE


ForeColor
ForeColor Property

Description

Specifies the color used to paint the caption when the control is not disabled.

Syntax

[form.]ctText.ForeColor [ = color& ]

Data Type

Long ( OLE_COLOR )

Example

ctText.ForeColor = RGB( 128, 128, 128 )


ForeColorOver
ForeColorOver Property

Description

Specifies the color used to paint the text when the mouse moves over the control. This property has no effect unless the CheckMouseOver property is set to a value of True.

Syntax

[form.]ctText.ForeColorOver [ = color& ]

Data Type

Long ( OLE_COLOR )

Example

ctText.ForeColorOver = RGB( 128, 128, 128 )


ImageXOffset
ImageXOffset Property

Description

Specifies the horizontal offset used to calculate the starting position of the BackImage property.

Syntax

[form.]ctText.ImageXOffset [ = setting% ]

Data Type

Integer

Example

ctText.ImageXOffset = 1


ImageYOffset
ImageYOffset Property

Description

Specifies the vertical offset used to calculate the starting position of the BackImage property.

Syntax

[form.]ctText.ImageYOffset [ = setting% ]

Data Type

Integer

Example

ctText.ImageYOffset = 1


MouseIcon
MouseIcon Property

Description

Specifies the custom image used for the cursor when the mouse moves over the control. This property will only accept valid icon or cursor images. This property will not be used unless the MousePointer property is set to a value of 99 (custom).

Syntax

[form.]ctText.MouseIcon [ = Picture ]

Data Type

Picture

Example

ctText.MouseIcon = Icon.Picture


MousePointer
MousePointer Property

Description

Specifies the mouse pointer to be used when the mouse is passing over the control. Valid values include ...

•	0 - Default

•	1 - Arrow

•	2 - Cross

•	3 - Beam

•	4 - Icon

•	5 - Size

•	6 - Size NE SW

•	7 - Size NS

•	8 - Size NW SE

•	9 - Size WE

•	10 - Up Arrow

•	11 - Hourglass

•	12 - No Drop

•	13 - App Starting

•	14 - Question

•	15 - Size All

•	16 - Finger

•	99 - Custom

Syntax

[form.]ctText.MousePointer [ = setting% ]

Data Type

Integer ( enumerated )

Example

ctText.MousePointer = 2


Picture
Picture Property

Description

Specifies the picture to be used in the background of the control.

In order to set the picture of the control, it must be either set using the picture property page of the control, the property table of the host language ( if available ), or by assigning a picture from another control to this one.

Syntax

[form.]ctText.Picture [ = Picture ]

Data Type

Picture

Example

ctText.Picture = OLE_Object.Picture


PicPosition
PicPosition Property

Description

Specifies the position of the bitmap image within the control. This property is also used to tile and size the bitmap image within the control. Valid values include ...

•	0 - Center

•	1 - Top Left

•	2 - Top Center

•	3 - Top Right

•	4 - Middle Left

•	5 - Middle Right

•	6 - Bottom Left

•	7 - Bottom Center

•	8 - Bottom Right

•	9 - Stretch to Fill

•	10 - Tile

•	11 - Hide

Syntax

[form.]ctText.PicPosition [ = setting% ]

Data Type

Integer ( enumerated )

Example

ctText.PicPosition = 2


ShadowColor
ShadowColor Property

Description

Specifies the color used to paint the drop shadow in a border type.

Syntax

[form.]ctText.ShadowColor [ = color& ]

Data Type

Long ( OLE_COLOR )

Example

ctText.ShadowColor = RGB( 128, 128, 128 )


SingleLine
SingleLine Property

Description

Specifies whether or not the text will be displayed on multiple lines, or a single line. In this case, if the value of this property is set to true, the line will only break where designated line break characters have been inserted.

Syntax

[form.]ctText.SingleLine [ = { True | False } ]

Data Type

Boolean

Example

ctText.SingleLine = TRUE


TextAngle
TextAngle Property

Description

Specifies the angle of which the text is to be displayed. A True Type font must be used with this attribute if the text is to be rotated. All rotated text will be rated based upon the center of the text and the center of the control.

Syntax

[form.]ctText.TextAngle [ = setting% ]

Data Type

Integer

Example

ctText.TextAngle = 90


TextPosition
TextPosition Property

Description

Specifies the position of the text within the control. Rotated text will always be placed in the center of the control. Valid values include ...

•	0 - Top	: Top aligned text

•	1 - Bottom	: Bottom aligned text

•	2 - Center	: Centered text

Syntax

[form.]ctText.TextPosition [ = setting% ]

Data Type

Integer ( enumerated )

Example

ctText.TextPosition = 2


TextXOffset
TextXOffset Property

Description

Specifies the horizontal offset used for the calculated position of the text in the control.

Syntax

[form.]ctText.TextXOffset [ = setting% ]

Data Type

Integer

Example

ctText.TextXOffset = 2


TextYOffset
TextYOffset Property

Description

Specifies the vertical offset used for the calculated position of the text in the control.

Syntax

[form.]ctText.TextYOffset [ = setting% ]

Data Type

Integer

Example

ctText.TextYOffset = 2


ThreeDColor
ThreeDColor Property

Description

Specifies the color used the paint the shadowed or three dimensional text. This property is only used if the ThreeDText property is set to a value of True.

Syntax

[form.]ctText.ThreeDColor [ = color& ]

Data Type

Long ( OLE_COLOR )

Example

ctText.ThreeDColor = RGB( 128, 128, 128 )


ThreeDText
ThreeDText Property

Description

Specifies whether or not the text will be displayed in a three dimensional sort of appearance ( with a shadow ).

Syntax

[form.]ctText.ThreeDText [ = { True | False } ]

Data Type

Boolean

Example

ctText.ThreeDText = TRUE


WordWrap
WordWrap Property

Description

Specifies whether or not the text will automatically be wrapped if the text is longer than the length of the control.

Syntax

[form.]ctText.WordWrap [ = { True | False } ]

Data Type

Boolean

Example

ctText.WordWrap = TRUE


MouseOn
MouseOn Event

Description

Occurs when the mouse initially moves over the control. This event will only fire if the CheckMouseOver property is set to a value of True.

Parameters

None