Hi,
I need to update the last line of Lines in my derived RichTextBox.
Since I can't do this:
Lines[Lines.Length -1] = history[historyIdx] as string;
I need to copy 'Lines' to a tmp array, change it and copy it back to
'Lines':
:
tmpTxtMatrix = new string[....];
Lines.CopyTo(tmpTxtMatrix, 0);
//Replace last line in console with history value
tmpTxtMatrix[tmpTxtMatrix.Length - 1] = history[historyIdx] as string;
//Setting the new lines array
Lines = tmpTxtMatrix;
SelectionStart = this.TextLength;
this.ScrollToCaret();
:
My problem is that this procedure causes the textBox to scroll up to
the begining of it, and then scroll back down to the last line.
Is there a way to update the last line without copying all lines?
If not, how do I prevent the scroll side effect?
Thanks!
Udi