> For the complete documentation index, see [llms.txt](https://docs.dbnetsoft.com/dbnetsoft/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dbnetsoft.com/dbnetsoft/screenspro/controls/timetextelement.md).

# TimeTextElement

This element displays a text whose characters are drawn one by one, so that a running time keeps its position on screen while the digits change.

It is the base of [ClockElement](/dbnetsoft/screenspro/controls/clockelement.md), [TargetTimeElement](/dbnetsoft/screenspro/controls/targettimeelement.md), [StopwatchElement](/dbnetsoft/screenspro/controls/stopwatchelement.md) and [Stopwatch2Element](/dbnetsoft/screenspro/controls/stopwatch2element.md). Those pages list only what each of them adds on top of the properties below.

## Properties

| Name                    | Type    | Description                                                                                                                                                                                                   |
| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Text`                  | String  | The text to display. It is also the content property, so it can be written between the tags.                                                                                                                  |
| `TextAlignment`         | Enum    | `Left`, `Right`, `Center` or `DecimalPoint`. Default `Left`.                                                                                                                                                  |
| `DecimalPointPadding`   | Double  | Distance kept between the decimal point and the right edge when `TextAlignment` is `DecimalPoint`. Default `20`.                                                                                              |
| `TextTrimming`          | Enum    | `NoTrimming` or `Scale`, which reduces the font size until the text fits. Default `NoTrimming`.                                                                                                               |
| `CharacterSpacing`      | Double  | Fixed width given to every character, so digits of different width do not move the rest of the time. `0` gives every character its own width. Default `0`.                                                    |
| `ForceCharacterSpacing` | Boolean | Applies `CharacterSpacing` to every character. While it is off, separators and punctuation keep their own width, and the spacing is only used at all when the text contains a decimal point. Default `false`. |
| `Casing`                | Enum    | `AsIs`, `Lowercase` or `Uppercase`. Default `AsIs`.                                                                                                                                                           |
| `VerticalSizing`        | Enum    | Which height the element takes and centers the text in: `LineBox`, `CapHeight` or `Ink`. Default `LineBox`.                                                                                                   |

## Alignment

`TextAlignment` decides where the time is placed horizontally inside the element:

| Value          | Description                                                                                                                                                                                                               |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Left`         | The text starts at the left edge, after `Padding.Left`.                                                                                                                                                                   |
| `Center`       | The text is centered in the width of the element.                                                                                                                                                                         |
| `Right`        | The text ends at the right edge.                                                                                                                                                                                          |
| `DecimalPoint` | The first `.` in the text starts `DecimalPointPadding` away from the right edge, so the decimal point stays in place while the time grows to the left (e.g. from `9.5` to `10.5`). A text without a `.` is right-aligned. |

## Trimming

`TextTrimming` decides what happens to a time that is wider than the element:

| Value        | Description                                                                 |
| ------------ | --------------------------------------------------------------------------- |
| `NoTrimming` | The text is drawn as it is and is cut off at the edge.                      |
| `Scale`      | The font size is reduced until the text fits into the width of the element. |

The other trimming values of the [TextElement](/dbnetsoft/screenspro/controls/textelement.md) (`Trim`, `TrimLastWord`, `TrimFirstname`) are not supported here and behave like `NoTrimming`.

## Casing

`Casing` changes the letters of the text. It is applied whenever `Text` changes.

| Value       | Description                                 |
| ----------- | ------------------------------------------- |
| `AsIs`      | The text is shown exactly as it is set.     |
| `Lowercase` | The text is converted to lowercase letters. |
| `Uppercase` | The text is converted to capital letters.   |

## Vertical sizing

`VerticalSizing` works the same way as on the [TextElement](/dbnetsoft/screenspro/controls/textelement.md#vertical-sizing):

| Value       | Description                                                                                                                                          |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LineBox`   | The font's line height, including the space for accents and descenders.                                                                              |
| `CapHeight` | From the top of the capital letters and digits to the baseline. The height stays the same while the time runs.                                       |
| `Ink`       | Exactly the top and bottom of the drawn glyphs. The height can change with the digits, since round digits reach slightly above and below the others. |

For a running time `CapHeight` is usually the better choice, so the element does not change its height while the digits change.

```xml
<controls:StopwatchElement VerticalSizing="CapHeight" FontSize="40" />
```
