本文介绍了如何使winforms程序等待(例如,按“enter”)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有WinForm应用程序。我有功能。在这个功能中有一个时刻,当我希望它停止前进并等待用户按输入键或指定按钮
我期待也许一些那种无限循环,等待按下特定的键盘按键?
我尝试了什么:
I got WinForm Application. I got function in it. And there is a moment in this function, when I want it to stop going forward and wait for user pressing "enter key" or specified button
I look forward maybe some kind of infnity loop, waiting for specific keyboard key pressed?
What I have tried:
Consol.ReadKey();
//ihad this error
//Cannot read keys when either application does not have a console or when console //input has been redirected from a file. Try Console.Read.
MessageBox.Show("button pressed");
推荐答案
这篇关于如何使winforms程序等待(例如,按“enter”)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!