/// <summary> /// Construct a ^FD (Field Data) element, together with the ^FO, ^A and ^FH. /// Control character will be handled (Convert to Hex or replace with ' ') /// </summary> /// <param name="text">Original text content</param> /// <param name="positionX"></param> /// <param name="positionY"></param> /// <param name="font"></param> /// <param name="newLineConversion"></param> /// <param name="useHexadecimalIndicator"></param> /// <param name="reversePrint"></param> /// <param name="bottomToTop"></param> public ZplTextField( string text, int positionX, int positionY, ZplFont font, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true, bool reversePrint = false, bool bottomToTop = false) : base(positionX, positionY, bottomToTop) { Text = text; Font = font; UseHexadecimalIndicator = useHexadecimalIndicator; NewLineConversion = newLineConversion; ReversePrint = reversePrint; }
public ZplTextBlock( string text, int positionX, int positionY, int width, int height, ZplFont font, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true) : base(text, positionX, positionY, font, newLineConversion, useHexadecimalIndicator) { Width = width; Height = height; if (newLineConversion == NewLineConversionMethod.ToZplNewLine) { throw new NotSupportedException("ToZplNewLine is not supported, use ZplFieldBlock"); } }
public ZplFieldBlock( string text, int positionX, int positionY, int width, ZplFont font, int maxLineCount = 1, int lineSpace = 0, TextJustification textJustification = TextJustification.Left, int hangingIndent = 0, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToZplNewLine, bool useHexadecimalIndicator = true, bool reversePrint = false) : base(text, positionX, positionY, font, newLineConversion, useHexadecimalIndicator, reversePrint) { TextJustification = textJustification; Width = width; MaxLineCount = maxLineCount; LineSpace = lineSpace; HangingIndent = hangingIndent; }
///<inheritdoc/> public override IEnumerable <string> Render(ZplRenderOptions context) { var gridSize = 100; var font = new ZplFont(fontWidth: 0, fontHeight: 20, fontName: "0"); var result = new List <string>(); for (var x = 0; x < 30; x++) { for (var y = 0; y < 30; y++) { var positionX = x * gridSize; var positionY = y * gridSize; result.AddRange(new ZplGraphicBox(positionX, positionY, gridSize, gridSize).Render()); result.AddRange(new ZplTextField($"X:{positionX}", positionX + 10, positionY + 30, font).Render()); result.AddRange(new ZplTextField($"Y:{positionY}", positionX + 10, positionY + 50, font).Render()); } } return(result); }