Allows construction of formatted (styled) text.
Namespace:
DYMO.Label.FrameworkAssembly: DYMO.Label.Framework (in DYMO.Label.Framework.dll) Version: 1.0.0.0 (8.4.0.1475)
Syntax
| C# |
|---|
public interface IStyledTextBuilder |
| Visual Basic (Declaration) |
|---|
Public Interface IStyledTextBuilder |
| Visual C++ |
|---|
public interface class IStyledTextBuilder |
Remarks
Use IStyledTextBuilder to construct IStyledText to specify formatted (styled) text.
StyledTextBuilder implements the interface.
Examples
The following example formats passed text on a line-by-line basis. Each line uses bold and italic font styles. The font size increases by
10 points from one line to the next.
CopyC#
IStyledText FormatLines(string text) { var styledTextBuilder = new StyledTextBuilder(); // start with this font size and increment it by 10 for each line double fontSize = 10; // separate text by lines foreach (var line in text.Split(Environment.NewLine.ToCharArray())) { // append a new line for a previous line if (fontSize > 10) styledTextBuilder.Append(new StyledTextBlock(Environment.NewLine, new FontInfo("Arial", fontSize - 10, FontStyle.Bold | FontStyle.Italic), Colors.Black)); // append current line styledTextBuilder.Append(line, new FontInfo("Arial", fontSize, FontStyle.Bold | FontStyle.Italic), Colors.Black); fontSize += 10; } return styledTextBuilder.StyledText; }