public void Append(ConsoleString str) { if (CurrentLine == null) { AddLine(); } var lines = str.Split("\n"); for (var i = 0; i < lines.Count; i++) { var line = lines[i]; CurrentLine.Text += line; AddLine(); } while (logStack.Controls.Count > MaxLines + 1) // +1 accounts for the empty line we usually have { logStack.Controls.RemoveAt(0); } scrollPanel.VerticalScrollUnits = Math.Max(0, logStack.Height - this.Height); }