midas+son의 크리에이티브(creative) 이야기

//입력이 있을 때까지 While()문 내에 있기 위해

//c++ 에서는 _kbhit()을 사용했었다.

//c#에서는 Console.KeyAvailable 이다.


            while (true)

            {

//0.5초는 please press anykey 를 보여주고

                Console.SetCursorPosition(50, 31);

                Console.Write("please press anykey");

                System.Threading.Thread.Sleep(500);

                if (Console.KeyAvailable) break;    //입력 된게 있으면 while문 break;

//0.5초는 비어있게 하고

                Console.SetCursorPosition(50, 31);

                Console.Write("                       ");

                System.Threading.Thread.Sleep(500);

                if (Console.KeyAvailable) break;    //입력 된게 있으면 while문 break;

            }

'공부 > C#' 카테고리의 다른 글

함수인자 ref, out  (0) 2016.05.09
Console Title명, 창 크기  (0) 2016.05.08
Console 커서 포지션(CursorPosition)  (0) 2016.05.08
class - is , as  (0) 2016.05.08
델리게이트(delegate) - 대리자  (0) 2016.05.08