Class TextItem
Represents a text item.
Inherited Members
Namespace: Neodynamic.SDK.Printing
Assembly: cs.temp.dll.dll
Syntax
public class TextItem : Item, IXmlTemplate, INotifyPropertyChanged
Constructors
TextItem()
Initializes a new instance of the TextItem class.
Declaration
public TextItem()
TextItem(Double, Double, Double, Double, String)
Initializes a new instance of the TextItem class with the specified location, size and text.
Declaration
public TextItem(double x, double y, double width, double height, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | The x-coordinate of the upper-left corner of the item relative to the upper-left corner of its container. |
| System.Double | y | The y-coordinate of the upper-left corner of the item relative to the upper-left corner of its container. |
| System.Double | width | The width of the item container. |
| System.Double | height | The height of the item container. |
| System.String | text | The text. |
Properties
BackColor
Gets or sets the background color of the text. Default value is White
Declaration
public Color BackColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
BackColorHex
Gets or sets the background color of the text in hex notation.
Declaration
public string BackColorHex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The Color Hex notation is as follows #[AA]RRGGBB where A, R, G, B refers to Aplha, Red, Green and Blue pixels. The following options would also be valid: #RGB or #ARGB (in this short format all channel values must be the same), #RRGGBB or #AARRGGBB.
BorderColor
Gets or sets the color of the border of the rectangle container. Default value is Black
Declaration
public Color BorderColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
BorderColorHex
Gets or sets the color of the border of the rectangle container in hex notation.
Declaration
public string BorderColorHex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The Color Hex notation is as follows #[AA]RRGGBB where A, R, G, B refers to Aplha, Red, Green and Blue pixels. The following options would also be valid: #RGB or #ARGB (in this short format all channel values must be the same), #RRGGBB or #AARRGGBB.
BorderThickness
Gets or sets the thickness for each side of the rectangle container. Default value is 0 (zero)
Declaration
public FrameThickness BorderThickness { get; set; }
Property Value
| Type | Description |
|---|---|
| FrameThickness |
CharSpacing
Gets or sets the horizontal spacing behavior between text characters. This value is added to the natural spacing between characters while rendering the text. A positive value will cause characters to spread farther apart, while a negative value will bring characters closer together. Unit depends on the current ThermalLabel Unit property. Default value is 0
Declaration
public double CharSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
CornerRadius
Gets or sets the radii of a rectangle's corners. Default value is 0 (zero)
Declaration
public RectangleCornerRadius CornerRadius { get; set; }
Property Value
| Type | Description |
|---|---|
| RectangleCornerRadius |
CounterStep
Gets or sets the step for the counter. The counter will increase (positive) or decrease (negative) by this number on every printed label. Default value is 0 (zero)
Declaration
public int CounterStep { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
CounterUseLeadingZeros
Gets or sets whether leading zeros are printed or suppressed when using counters. Default value is false
Declaration
public bool CounterUseLeadingZeros { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
CultureName
Gets or sets the Culture Name for text formatting. Default is en-US. Other sample values: de-DE, es-ES, etc. Any value supported by .NET CultureInfo class.
Declaration
public string CultureName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Font
Gets the Font object for the text. Default value is Arial, 8pt
Declaration
public Font Font { get; }
Property Value
| Type | Description |
|---|---|
| Font |
ForeColor
Gets or sets the foreground color of the text. Default value is Black
Declaration
public Color ForeColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
ForeColorHex
Gets or sets the foreground color of the text in hex notation.
Declaration
public string ForeColorHex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The Color Hex notation is as follows #[AA]RRGGBB where A, R, G, B refers to Aplha, Red, Green and Blue pixels. The following options would also be valid: #RGB or #ARGB (in this short format all channel values must be the same), #RRGGBB or #AARRGGBB.
HasFixedContent
Declaration
protected override bool HasFixedContent { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
Height
Gets or sets the height of the text item. Default value is 0.5
Declaration
public double Height { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
HideIfEmpty
Gets or sets whether this text item is not displayed or printed if the value to encode is empty. Default value is false
Declaration
public bool HideIfEmpty { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
InputMaskPattern
Gets or sets the input mask pattern to use at design time on the label editor. Default is an empty string. The Input Mask Pattern must be a string composed of one or more of the following masking elements:
- 0 - Digit, required. This element will accept any single digit between 0 and 9.
- 9 - Digit or space, optional.
- # - Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the Text property. Plus (+) and minus (-) signs are allowed.
- L - Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions.
- ? - Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions.
- & - Character, required.
- C - Character, optional. Any non-control character.
- A - Alphanumeric, required.
- a - Alphanumeric, optional.
- . - Decimal placeholder.
- , - Thousands placeholder.
- : - Time separator.
- / - Date separator.
- $ - Currency symbol.
- < - Shift down. Converts all characters that follow to lowercase.
- > - Shift up. Converts all characters that follow to uppercase.
- | - Disable a previous shift up or shift down.
- \ - Escape. Escapes a mask character, turning it into a literal. "\" is the escape sequence for a backslash.
- All other characters - Literals. All non-mask elements will appear as themselves within TextItem. Literals always occupy a static position in the mask at design time, and cannot be moved or deleted by the end user.
Declaration
public string InputMaskPattern { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
InputMaskPromptChar
Gets or sets the character used to represent the absence of user input. At design time on the label editor, this character will be displayed in the TextItem for any input mask pattern position that the end user has not yet filled in. Default is an underscore (_).
Declaration
public char InputMaskPromptChar { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Char |
LineSpacing
Gets or sets the vertical spacing behavior between lines of text. This value is added to the natural line spacing. A positive value will cause lines to spread farther apart, while a negative value will bring lines closer together. Unit depends on the current ThermalLabel Unit property. Default value is 0
Declaration
public double LineSpacing { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Mask
Gets or sets the input Mask for the text. Default value is an empty string
- D or d: Decimal numeric 0-9
- H or h: Hexadecimal 0-9 plus a-f or A-F
- O or o: Octal 0-7
- A or a: Alphabetic A-Z or a-z
- N or n: Alphanumeric 0-9 plus A-Z or a-z
- %: Ignore character or skip
Declaration
public string Mask { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The length of the mask defines the number of characters to be formatted or masked. The mask is aligned to the characters in the target string starting with the right-most position.
MaskIncrement
Gets or sets the mask increment. The increment is the value to be added to the text on each label to be printed. Default value is an empty string
Declaration
public string MaskIncrement { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The default value for the increment is equivalent to a decimal value of 1 (one). The string is composed of any characters defined in the input mask. Invalid characters are assumed to be equal to a value of 0 (zero) in that characters position.
The increment value for alphabetic strings start with 'A' or 'a' as the zero placeholder. This means to increment an alphabetic character by one, a value of 'B' or 'b' must be in the increment string.
For characters that do not get incremented, the '%' character needs to be added to the increment string.
MaxLength
Gets or sets the maximum number of characters allowed for this text item object. Default is 0 which means that unlimited number of characters will be allowed.
Declaration
public int MaxLength { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Multiline
Gets or sets whether the text can span more than one line. Default is true.
Declaration
public bool Multiline { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
RightToLeft
Gets or sets whether the text should draw right-to-left for RTL languages. Default value is false
Declaration
public bool RightToLeft { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
RotationAngle
Gets or sets the rotation angle to apply on this item. It is measured clockwise from the x-axis. Default value is 0 (zero)
Declaration
public int RotationAngle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Sizing
Gets or sets the text sizing. Default value is None
Declaration
public TextSizing Sizing { get; set; }
Property Value
| Type | Description |
|---|---|
| TextSizing |
StrokeColorHex
Gets or sets the text stroke color in hex notation.
Declaration
public string StrokeColorHex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The Color Hex notation is as follows #[AA]RRGGBB where A, R, G, B refers to Aplha, Red, Green and Blue pixels. The following options would also be valid: #RGB or #ARGB (in this short format all channel values must be the same), #RRGGBB or #AARRGGBB.
StrokeThickness
Gets or sets the text stroke thickness. Default value is 0.
Declaration
public double StrokeThickness { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | The specified value is less than 0. |
Text
Gets or sets the text. Default value is an empty string
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
TextAlignment
Gets or sets the alignment of the text. Default value is Left
Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment |
TextPadding
Gets or sets the amount of space between the container's border and the text content. Default value is 0 (zero)
Declaration
public FrameThickness TextPadding { get; set; }
Property Value
| Type | Description |
|---|---|
| FrameThickness |
TextVerticalAlignment
Gets or sets the alignment of the text. Default value is Top
Declaration
public TextVerticalAlignment TextVerticalAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextVerticalAlignment |
ValidationErrorMessage
Gets or sets the text for the error message when validation fails. Default value is an empty string
Declaration
public string ValidationErrorMessage { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
ValidationRegEx
Gets or sets the regular expression (must be based in the ECMAScript regex engine) that determines the pattern used to validate this text item. Default value is an empty string
Declaration
public string ValidationRegEx { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Width
Gets or sets the width of the text item. Default value is 1
Declaration
public double Width { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
Clone()
Creates a copy of the current TextItem.
Declaration
public override Item Clone()
Returns
| Type | Description |
|---|---|
| Item | A copy of the current TextItem. |
Overrides
ConvertToUnit(UnitType)
Declaration
public override void ConvertToUnit(UnitType unit)
Parameters
| Type | Name | Description |
|---|---|---|
| UnitType | unit |
Overrides
GetAutoSize()
Gets the size of this TextItem that fits its content.
Declaration
public Tuple<double, double> GetAutoSize()
Returns
| Type | Description |
|---|---|
| System.Tuple<System.Double, System.Double> | The size of this TextItem that fits its content. Item1 refers to the Width and Item2 refers to the Height. |
GetAutoSize(Double)
Gets the size of this TextItem that fits its content within the specified maximum width.
Declaration
public Tuple<double, double> GetAutoSize(double maxWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | maxWidth | The maximum text width (length) in the specified UnitType of this TextItem. |
Returns
| Type | Description |
|---|---|
| System.Tuple<System.Double, System.Double> | The size of this TextItem that fits its content within the specified maximum width. Item1 refers to the Width and Item2 refers to the Height. |
UpdateFrom(Item)
Declaration
public override void UpdateFrom(Item item)
Parameters
| Type | Name | Description |
|---|---|---|
| Item | item | The TextItem object that is used for updating this TextItem object. |