wpf 在 Windows 窗体中创建类似 UI 的控制台
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13098766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating a Console like UI in Windows Forms
提问by Abijeet Patro
Hi I'm trying to create a console like interface using a richtextbox in WinForms using C#.
嗨,我正在尝试使用 C# 在 WinForms 中使用富文本框创建类似控制台的界面。
The reason why I am using a richtextbox is I want a few features such as selection,copy-paste that are not present in a normal console application.
我使用富文本框的原因是我想要一些普通控制台应用程序中不存在的功能,例如选择、复制粘贴。
I was wondering if it was possible to change the blinking cursor from the blinking "|" to a blinking "_"
我想知道是否可以从闪烁的“|”更改闪烁的光标 到闪烁的“_”
Even if I could hide the original "|", I could then implement a functionality on the onchange event of the richtextbox to display the blinking, "_"
即使我可以隐藏原始的“|”,我也可以在 Richtextbox 的 onchange 事件上实现一个功能来显示闪烁的“_”
I also had another related question, but I don't know if I should put that here as well.
我还有另一个相关的问题,但我不知道我是否也应该把它放在这里。
Also, if it will be easier to implement something like this using WPF, I'm willing to move.
另外,如果使用 WPF 更容易实现这样的东西,我愿意搬家。
回答by Mohammad Banisaeid
You need to change your RichTextBox's caret. Take a look at this: Custom Caret for WinForms richtextbox
您需要更改 RichTextBox 的插入符号。看看这个:WinForms Richtextbox 的自定义插入符号
回答by th1rdey3
have a look at this Command Prompt Control
看看这个命令提示符控制
回答by KalG
May be this one will suite for your need
可能是这个适合您的需要
http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor
http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor

