///////////////////////////////////////////////////////////////////////////////// #region [ Public Methods ] /// <summary> /// Appends text of the text box. In multiline mode adds new line, while /// in singleline mode appends current line. /// </summary> /// public void AppendText(string text) { if (this.Items == null) { // Reset text position and lines collection to defaults CursorLeft = 0; CursorTop = 0; CurrentRow = 0; CurrentColumn = 0; ViewFromRow = 0; ViewFromColumn = 0; this.Items = new TaggedTextCollection(); } if (text == null) { return; } if (Multiline) { this.Items.Add(TaggedText.ClearFromControlCharacters(text)); } else // append current line { Current += TaggedText.ClearFromControlCharacters(text); } Invalidate(); }
///////////////////////////////////////////////////////////////////////////////// #region [ Public Methods ] /// <summary> /// Adds a new TaggedText item to the ComboBox. /// </summary> /// public void AddItem(TaggedText item) { item = TaggedText.ClearFromControlCharacters(item.Text, item.Tag); Items.Add(item); Invalidate(); }
///////////////////////////////////////////////////////////////////////////////// /// <summary> /// Appends text from string collection. /// </summary> /// public void AppendText(List <string> array) { if (this.Items == null) { // Reset text position and lines collection to defaults CursorLeft = 0; CursorTop = 0; CurrentRow = 0; CurrentColumn = 0; ViewFromRow = 0; ViewFromColumn = 0; this.Items = new TaggedTextCollection(); } if (array == null) { return; } if (Multiline) { foreach (string line in array) { this.Items.Add(TaggedText.ClearFromControlCharacters(line)); } } else // append current line { Current += TaggedText.ClearFromControlCharacters( string.Join(" ", array.ToArray())); } Invalidate(); }