usingcAlgo.API;namespacecAlgo{// This sample indicator shows how to use TextWrapping property to manage the text wrap[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]publicclassTextWrappingSample:Indicator{[Parameter("Text", DefaultValue = "very long texttttttttttttttttttttt")]publicstringText{get;set;}[Parameter("Wrapping", DefaultValue = TextWrapping.NoWrap)]publicTextWrappingTextWrapping{get;set;}protectedoverridevoidInitialize(){varstackPanel=newStackPanel{BackgroundColor=Color.Gold,HorizontalAlignment=HorizontalAlignment.Center,VerticalAlignment=VerticalAlignment.Center,Opacity=0.6,Width=100};stackPanel.AddChild(newTextBlock{Text=Text,FontWeight=FontWeight.ExtraBold,ForegroundColor=Color.Blue,TextWrapping=TextWrapping});Chart.AddControl(stackPanel);}publicoverridevoidCalculate(intindex){}}}
1 2 3 4 5 6 7 8 910111213141516171819202122
importclrclr.AddReference("cAlgo.API")fromcAlgo.APIimport*classTest():definitialize(self):stackPanel=StackPanel()stackPanel.BackgroundColor=Color.GoldstackPanel.HorizontalAlignment=HorizontalAlignment.CenterstackPanel.VerticalAlignment=VerticalAlignment.CenterstackPanel.Opacity=0.6stackPanel.Width=100textBlock=TextBlock()# Text is a parameter of type string# defined in indicator C# filetextBlock.Text=api.Text# TextWrapping is a parameter of type TextWrapping# defined in indicator C# filetextBlock.TextWrapping=api.TextWrappingtextBlock.FontWeight=FontWeight.ExtraBoldtextBlock.ForegroundColor=Color.BluestackPanel.AddChild(textBlock)api.Chart.AddControl(stackPanel)
Fields
WrapWithOverflow
Summary
Line-breaking occurs if the line overflows beyond the available block width. However, a line may overflow beyond the block width if the line breaking algorithm cannot determine a line break opportunity, as in the case of a very long word constrained in a fixed-width container with no scrolling allowed.
Signature
1
TextWrapping.WrapWithOverflow;
Return Value
TextWrapping
NoWrap
Summary
No line wrapping is performed.
Signature
1
TextWrapping.NoWrap;
Return Value
TextWrapping
Wrap
Summary
Line-breaking occurs if the line overflows beyond the available block width, even if the standard line breaking algorithm cannot determine any line break opportunity, as in the case of a very long word constrained in a fixed-width container with no scrolling allowed.