Looking for a UserControl which supports ANSI esca

2019-07-01 11:02发布

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 scrolled 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.

3条回答
乱世女痞
2楼-- · 2019-07-01 11:18

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.

查看更多
不美不萌又怎样
3楼-- · 2019-07-01 11:26

Take a look at Dart's Vt.NET control (assuming that a VTxxx emulation is close enough to an ansi emulation).

查看更多
我只想做你的唯一
4楼-- · 2019-07-01 11:31

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...

查看更多
登录 后发表回答