TextTrimming
enum cAlgo.API
DesktopCLICloud
Describes how text is trimmed when it overflows the edge of its containing box.
Definition
public enum TextTrimming
Namespace: cAlgo.API · Group: Controls
Examples
using cAlgo.API;
namespace cAlgo
{
// This sample indicator shows how to use TextTrimming property to manage the text trim
public partial class TextTrimmingSample : Indicator
{
protected override void Initialize()
{
var stackPanel = new StackPanel
{
BackgroundColor = Color.Gold,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Opacity = 0.6,
Width = 100
};
stackPanel.AddChild(new TextBlock
{
Text = Text,
FontWeight = FontWeight.ExtraBold,
ForegroundColor = Color.Blue,
TextTrimming = TextTrimming
});
Chart.AddControl(stackPanel);
}
public override void Calculate(int index)
{
}
}
}
import clr
clr.AddReference("cAlgo.API")
from cAlgo.API import *
class Test():
def initialize(self):
stackPanel = StackPanel()
stackPanel.BackgroundColor = Color.Gold
stackPanel.HorizontalAlignment = HorizontalAlignment.Center
stackPanel.VerticalAlignment = VerticalAlignment.Center
stackPanel.Opacity = 0.6
stackPanel.Width = 100
textBlock = TextBlock()
textBlock.Text = api.Text
textBlock.TextTrimming = api.TextTrimming
textBlock.FontWeight = FontWeight.ExtraBold
textBlock.ForegroundColor = Color.Blue
stackPanel.AddChild(textBlock)
api.Chart.AddControl(stackPanel)
{
"AccessRights": "None",
"TimeZone": "UTC",
"IsOverlay": true,
"Parameters": [
{
"Name": "Text",
"Type": "String",
"DefaultValue": "very long texttttttttttttttttttttt"
},
{
"Name": "TextTrimming",
"DisplayName": "Trimming",
"Type": "Enum",
"EnumTypeFullName": "cAlgo.API.TextTrimming",
"DefaultValue": "CharacterEllipsis"
}
]
}
Values
| Name | Value | Description |
|---|---|---|
None | 0 | Text is not trimmed. |
CharacterEllipsis | 1 | Text is trimmed at a character boundary. An ellipsis (...) is drawn in place of remaining text. |
WordEllipsis | 2 | Text is trimmed at a word boundary. An ellipsis (...) is drawn in place of remaining text. |