Updating single characters in large TextBox programmatically
Reading lots of characters and updating a textbox was suggested to me when I created this question, and it was exactly what I was looking for (couldn't find it by just searching). However a couple of points need clarifying.
I am looking to upgrade to a ListBox
or even RichTextBox
. For now I want to be able to replace as little of the onscreen (and off, as an added bonus) text as possible.
In the first link Guffa wrote:
If the data is line based, use a list instead of a text box, so that you only have to update the last line when you add a character.
I have a split pane where updates to one TextBox
are translated and shown on the other side, and vice-versa. I've briefly toyed with a ListBox
but it doesn't provide the intrinsic text-editing funcionality of a TextBox
so I went back.
What component should I be using? I wouldn't have thought that with all of .NET available I should 开发者_Python百科have to consider Win32.
Ok, no one else has offered an answer so I will propose a solution which is the last one open to me short of refactoring back to Win32 API calls.
The solution is to use two textboxes. Instead of replacing the text element of the on-screen one you replace that of its dupe, which at the time is hidden, you then toggle the visible flags of both.
I'll let you know how it goes but it is major work for not much advantage, I'll prolly just live with a bit of flicker for now.
精彩评论