Looking for a UserControl which supports ANSI escape codes

痞子三分冷 提交于 2020-01-04 05:10:17

问题


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.


回答1:


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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/1889378/looking-for-a-usercontrol-which-supports-ansi-escape-codes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!