I am looking to handle incoming telnet text that has ANSI escape codes. For the bounty I am looking for a full implementation where I can just append text to the end of a buffer. The control should be scrollable, yet still be able to handle appending text, cursor positioning, etc.. while the user is scr开发者_运维技巧olled out of view.
For example,
"\e[0;32mHello \e[0;37mWorld"
Would display a green "Hello" and a white "World"
As this would need to handle cursor positioning, setting a default 80 characters per row (80 columns) would be fine, but also needs to handle other column sizes. Would be nice to be able to change the font as well.
See Wikipedia ANSI Escape Codes for more information.
Take a look at Dart's Vt.NET control (assuming that a VTxxx emulation is close enough to an ansi emulation).
checkout the following link: AckTerm @ sourceforge.com
i'm trying to translate ANSI codes coming from a serial interface using Terminal Control project from www.sourceforge.com written in C# - if ackterm won't be good for you google terminal control project
hope it is what you are looking for...
Assuming you mean "ANSI escape code," you can start by converting each escape code in your string into a color (since it sounds like those are the only codes you're interested in). Just use a table like the one here (bottom of page) and do a little bit of custom string parsing.
ANSI escape codes are pretty old-school, so I wouldn't expect them to have the intended effect. They're meant for controlling output to text terminals, not fancy stuff like a .NET user control.
精彩评论