在C#控制台应用程序编辑的文本? [英] Edit text in C# console application?

查看:140
本文介绍了在C#控制台应用程序编辑的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
   C#高级控制台I / O

有没有办法来编辑在C#控制台应用程序的文本?换句话说,有没有可能把pre定义的文本在命令行上,以便用户可以修改文本,然后将其重新提交的应用程序?

Is there a way to edit text in a C# console application? In other words, is it possible to place pre-defined text on the command line so that the user can modify the text and then re-submit it to the app?

推荐答案

一件事。 而且采用的SendKeys一个简单的例子:

One thing that came to my mind is to...simulate keystrokes. And a simple example using SendKeys:

static void Main(string[] args)
{
    Console.Write("Your editable text:");
    SendKeys.SendWait("hello"); //hello text will be editable :)
    Console.ReadLine();
}

注意:这仅适用于当前窗口

这篇关于在C#控制台应用程序编辑的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆