ScreenLabel

Description

abstract class Tinman.Engine.Drawing.ScreenLabel

Derived from

VersionedBase abstract
IScreenLabelContent

Extended by

Example_ScreenLabel sealed
Gizmo abstract

Abstract base class for IScreenLabel implementations.

Public / Constructors

For​Icon

2 overloads


public static method ForIcon1 → (2)

path opt : string = null

The initial image icon or null.

style opt : ScreenLabelIconStyle = null

The initial styles or null to use default styles.

returns → IScreenLabelIcon

The screen label.

Creates a screen label that renders an image icon.


public static method ForIcon2 → (2)

icon opt : IResourceHandle = null

The initial image icon or null.

style opt : ScreenLabelIconStyle = null

The initial styles or null to use default styles.

returns → IScreenLabelIcon

The screen label.

Creates a screen label that renders an image icon.

See also

Bitmap

For​String


public static method ForString → (2)

text opt : string = null

The initial text content or null.

style opt : ScreenLabelTextStyle = null

The initial styles or null to use default styles.

returns → IScreenLabelText

The screen label.

Creates a screen label that renders a (possibly) multi-lined text using the given styles.

+----------------------------------+   bounds
|                                  |
|   +--------------------------+   |   text box
|   |Left justification        |   |
|   |                          |   |
|   |   Center justification   |   |
|   |                          |   |
|   |      Right justification |   |
|   +--------------------------+   |
|                                  |
+----------------------------------+

The bounds are provided as an argument to the IScreenLabel.RenderScreenLabel method. Based on the given bounds, the label layout is computed as follows:

  1. The measured text box is aligned with the computed bounds using the current ScreenLabelTextStyle.TextAnchor.

  2. The justification (left, center, right) of each text line is determined by the horizontal ScreenLabelTextStyle.TextAnchor flag.

The measured text box and the computed bounds may have different sizes. To ensure that both boxes have the same size, the size returned by IScreenLabel.PrepareScreenLabel must be passed to as the bounds parameter to the ScreenLabelPlacement.Add method.

For​Text


public static method ForText → (2)

text opt : Text = null

The initial text content or null.

style opt : ScreenLabelTextStyle = null

The initial styles or null to use default styles.

returns → IScreenLabelText

The screen label.

Creates a screen label that renders a (possibly) multi-lined text using the given styles.

+----------------------------------+   bounds
|                                  |
|   +--------------------------+   |   text box
|   |Left justification        |   |
|   |                          |   |
|   |   Center justification   |   |
|   |                          |   |
|   |      Right justification |   |
|   +--------------------------+   |
|                                  |
+----------------------------------+

The bounds are provided as an argument to the IScreenLabel.RenderScreenLabel method. Based on the given bounds, the label layout is computed as follows:

  1. The measured text box is aligned with the computed bounds using the current ScreenLabelTextStyle.TextAnchor.

  2. The justification (left, center, right) of each text line is determined by the horizontal ScreenLabelTextStyle.TextAnchor flag.

The measured text box and the computed bounds may have different sizes. To ensure that both boxes have the same size, the size returned by IScreenLabel.PrepareScreenLabel must be passed to as the bounds parameter to the ScreenLabelPlacement.Add method.