IO 使用readKey即时显示数据到控制台

View Code
 static void Main(string[] args)
        {
            ConsoleKeyInfo c 
= new ConsoleKeyInfo();
            
            ConsoleKeyInfo cki;
            
do
            {  
                cki 
= Console.ReadKey();
                
if ((cki.Modifiers & ConsoleModifiers.Control) != 0)
                    Console.WriteLine(
"ctrl");
                
if ((cki.Modifiers & ConsoleModifiers.Alt) != 0)
                    Console.WriteLine(
"alt");
                
if ((cki.Modifiers & ConsoleModifiers.Shift) != 0)
                    Console.WriteLine(
"shift");

            } 
while (cki.Key != ConsoleKey.Escape);

            
        }

 

使用readkey键来即时显示数据,直到按esec键为止

 

 

posted on 2011-07-30 23:53  wtq  阅读(266)  评论(0编辑  收藏  举报