[英]How do I detect if the spaced bar is typed/Pressed using C# on mac?
我正在編寫一個程序,如果按下空格鍵,它將執行某些操作。 我到目前為止:
Console.WriteLine("Listening for the BIG BUTTON:......... ");
ConsoleKeyInfo name = Console.ReadKey();
Console.WriteLine("You pressed {0}", name.KeyChar);
if(//keyPressed is the spacekey" ){
Console.WriteLine("Space key is pressed);
}
https://msdn.microsoft.com/zh-CN/library/system.consolekey(v=vs.110).aspx
Console.WriteLine("Listening for the BIG BUTTON:......... ");
ConsoleKeyInfo name = Console.ReadKey();
Console.WriteLine("You pressed {0}", name.KeyChar);
if(name.Key == ConsoleKey.Spacebar )
{
Console.WriteLine("Space key was pressed");
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.