开发者

Using a (Rich)TextBox as a window onto a larger buffer

开发者 https://www.devze.com 2023-02-19 06:04 出处:网络
I feel like I\'m missing an obvious point here, but let\'s say I\'m working on a text editor, and I\'d like to store a file\'s (partial?) contents as a text buffer.My text buffer is some specialized d

I feel like I'm missing an obvious point here, but let's say I'm working on a text editor, and I'd like to store a file's (partial?) contents as a text buffer. My text buffer is some specialized data structure for holding lots of text, not just a simple string or StringBuilder. I'd also like to expose the text to the user, probably through a standard text box or rich text box.

What is the best means of doing this?

Would I copy a segment out of the buffer into the textbox, then adjust everything manually and copy changes bac开发者_JAVA技巧k? Would I copy the entire buffer as a string into the textbox? If I was only loading part of a file into the buffer (to handle very large files) would I have to set up a second translation layer from buffer to file? Do I need an entirely different control from the built in textboxes to accomplish this?

EDIT: I'd also accept suggestions for 3rd-party text controls that would work well. My main block here is not wanting to build/learn/import the entirety of (for example) GTK or QT just to get a decent text editor control.


See the ebook referenced from this question, the sharpdevelop guys go into some detail on how to construct a text editor.


I use a RichTextBox in logview4net as a window on whatever data I'm looking at. It is only forward scrolling and I can't really say I like it.

I think you're better off looking for some other editor control.

0

精彩评论

暂无评论...
验证码 换一张
取 消