Copyright © 2003-2024 MultiMedia Soft

How to add text to the control

Previous pageReturn to chapter overviewNext page

The simplest way to display texts over the control surface is to open, at Design-time, the 3D Button Visual Editor application from inside the Visual Studio.NET IDE as described inside the chapter Editing control properties through the 3D Button Visual Editor application contained inside the How to use the product in your projects section and selecting the editor "Text" tab; as you will see on the table below, you can reach all of these settings at runtime using the corresponding property.

As you can see on the image below you have the possibility to enter at the same time up to 9 different texts over the button surface, each with its own fonts, settings and colors.

3dcm_i000003

Note: The image below has hot links to take you to explanations of the text controls.

3dcm_i000109

3dcm_i00010a

 

 

Item name

Description

Corresponding property


Available texts

The set of available texts that can be displayed on the button surface: clicking one of these buttons will load the settings that govern the selected text.

 


Caption button

Loads the Caption text settings

TextDescrCaption or Caption


Left Top button

Loads the Left Top text settings

TextDescrLT


Center Top button

Loads the Center Top text settings

TextDescrCT


Right Top button

Loads the Right Top text settings

TextDescrRT


Left Middle button

Loads the Left Middle text settings

TextDescrLM


Right Middle button

Loads the Right Middle text settings

TextDescrRM


Left Bottom button

Loads the Left Bottom text settings

TextDescrLB


Center Bottom button

Loads the Center Bottom text settings

TextDescrCB


Right Bottom button

Loads the Left Right Bottom text settings

TextDescrRB

 

The properties TextDescrCaption, TextDescrLT, TextDescrCT, TextDescrRT, TextDescrLM, TextDescrRM, TextDescrLB, TextDescrCB, and TextDescrRB are internally implemented as "expandable objects" of class TextDescriptor: thanks to this "object oriented" approach, each of these properties have a set of sub-properties that allow a better control of the following "text rendering" aspects:

 

Item name

Description

Corresponding property

 

 

 

 


Text

The text that will appear over the button: it can be multi-line (press the Enter key each time you need to create a new line of text).

TextDescriptor.Text


Visible

Hides/shows the selected text

TextDescriptor.Visible


Offset X

Offset from the default horizontal position

TextDescriptor.OffsetX


Offset Y

Offset from the default vertical position

TextDescriptor.OffsetY


Effect

Enhancement special effect applied to text

TextDescriptor.SpecialEffect


Factor

Enhancement special effect factor

TextDescriptor.SpecialEffectFactor


Double space

Applies/removes double space

TextDescriptor.DoubleSpace


Antialias

Applies/removes anti-aliasing to text borders

TextDescriptor.Antialias


Transparency

Applies alpha channel transparency to text.

TextDescriptor.TransparentFactor


Rotation angle

Text rotation angle

TextDescriptor.Angle


Normal Color (Up)

Text color when the button is in Normal state.

TextDescriptor.ColorNormal or ForeColor


Mouse over Color

Text color when the mouse is over the button surface: if this color is left undefined the Normal Color will be used.

The undefined state is represented with the 3dcm_i00005a symbol inside the color box. Once the color has been defined, it can be reset back to the undefined state by double-clicking the relative color box (not the "..." button).

TextDescriptor.ColorMouseOver


Pressed Color (Down)

Text color when the button is in Pressed state: if this color is left "undefined" the Normal Color will be used.

The undefined state is represented with the 3dcm_i00005a symbol inside the color box. Once the color has been defined, it can be reset back to the undefined state by double-clicking the relative color box (not the "..." button).

TextDescriptor.ColorPressed


Disabled Color (all)

Text color when the button is in Disabled state: this property applies to all texts at the same time.

ForeColorDisabled


Highlight effect color

Color of the highlighted text portion (available when a special effect is applied): if this color is left undefined the color will be calculated automatically.

The undefined state is represented with the 3dcm_i00005a symbol inside the color box. Once the color has been defined, it can be reset back to the undefined state by double-clicking the relative color box (not the "..." button).

TextDescriptor.ColorHighlight


Shadow effect color

Color of the shadowed text portion (available when a special effect is applied): if this color is left undefined the color will be calculated automatically.

The undefined state is represented with the 3dcm_i00005a symbol inside the color box. Once the color has been defined, it can be reset back to the undefined state by double-clicking the relative color box (not the "..." button).

TextDescriptor.ColorShadow


Halo effect color

Color used to create a Halo special effect.

TextDescriptor.ColorHalo


Solid background

Applies/removes a solid background under the text position

TextDescriptor.SolidBack


Solid background Color

Color of the solid background, if any

TextDescriptor.ColorSolidBack


Background border

Applies/removes a line border around the text position

TextDescriptor.Border


Background border Color

Color of the border, if any

TextDescriptor.ColorBorder


Background shadow

Applies/removes a shadow to the text solid background, if any

TextDescriptor.SolidBackShadow


Background shadow Color

Color of the shadow, if any

TextDescriptor.ColorSolidBackShadow


"..." color editing buttons

These buttons will open the color choice dialog box for the corresponding property.

 

 

The Caption text has a couple of further features for better control of text positioning.

 

Item name

Description

Corresponding property


Align

The text alignment (Left, Center and Right).

TextCaptionAlignment


Wordwrap %

Constrains the button surface percentage that will contain the text.

CaptionWordWrapPerc

 

 

Fonts related settings are managed through the use of the following properties: FontTextCaption, FontTextLT, FontTextCT, FontTextRT, FontTextLM, FontTextRM, FontTextLB, FontTextCB and FontTextRB. These properties are implemented using the standard Font class (check the Microsoft documentation or MSDN for details) so each of these properties has a set of standard sub-properties that allow a better control of the following aspects of the "font rendering":

 

Item name

Description

Corresponding property


Font

The font name (also known as typeface or facename): only TrueType (marked with the3dcm_i000086 symbol) and OpenType (marked with the3dcm_i000087 symbol) fonts are supported.

Font.Name


Size

The height of the button expressed in points

Font.Size


B Bold checkbox

Sets/resets the bold attribute

Font.Bold


I Italic checkbox

Sets/resets the italic attribute

Font.Italic


U Underline checkbox

Sets/resets the underline attribute

Font.Underline


S Strikethrough checkbox

Sets/resets the strikethrough attribute

Font.Strikethrough