我程序中的ReadKey()中的IO流从键盘上的键中获取了键,但是SHIFT ALT CONTROL每当按下这三个键时都没有 [英] IO Stream in ReadKey() in my program taken keys from key bord but SHIFT ALT CONTROL Not taken whenever press the these three

查看:96
本文介绍了我程序中的ReadKey()中的IO流从键盘上的键中获取了键,但是SHIFT ALT CONTROL每当按下这三个键时都没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

do
{
    Keypress = Console.ReadKey();
    Console.WriteLine("  Your Key is : " + Keypress.KeyChar);

    if ((ConsoleModifiers.Alt & Keypress.Modifiers) != 0)         
        Console.WriteLine(" Alt Key pressed: ");
                
    if ((ConsoleModifiers.Control & Keypress.Modifiers) != 0)
        Console.WriteLine(" Control Key pressed:");

    if ((ConsoleModifiers.Shift & Keypress.Modifiers) != 0)
        Console.WriteLine(" shift key pressed:");
}
while (Keypress.KeyChar != 'Q');



感谢宝贵的重播



thanks for valuable replay

推荐答案

阅读此线程,

http://stackoverflow.com/questions/1367700/whats-互联网上的差异之间的差异 [ http://stackoverflow.com/questions/4620408/e-keychar-does- not-work-for-ctrl [ ^ ]
希望对您有帮助
Read this thread,

http://stackoverflow.com/questions/1367700/whats-the-difference-between-keydown-and-keypress-in-net[^]
and then this
http://stackoverflow.com/questions/4620408/e-keychar-does-not-work-for-ctrl[^]
Hope it helps


这篇关于我程序中的ReadKey()中的IO流从键盘上的键中获取了键,但是SHIFT ALT CONTROL每当按下这三个键时都没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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