Задать вопрос

Как распознать клавишу Alt в терминале?

// Program.cs

int width = Console.WindowWidth - 1;
int height = Console.WindowHeight - 1;

Console.Write ("\e[?1049h");

Console.SetCursorPosition (0, 0);
Console.Write ("\e[1m≡ File Edit View Window Help\e[0m");

Console.SetCursorPosition (0, 2);
Console.Write ("┌");
Console.SetCursorPosition (width, 2);
Console.Write ("┐");
Console.SetCursorPosition (0, height);
Console.Write ("└");
Console.SetCursorPosition (width, height);
Console.Write ("┘");

while (true)
{
	var key = Console.ReadKey (true);
	
	if (key.Key == ConsoleKey.Q && key.Modifiers.HasFlag(ConsoleModifiers.Control))
	{
		break;
	}
}

Console.Write ("\e[?1049l");


Не Alt+другая клавиша, а чистый Alt?
  • Вопрос задан
  • 45 просмотров
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ответы на вопрос 1
VoidVolker
@VoidVolker Куратор тега C#
Dark side eye. А у нас печеньки! А у вас?
Learn / Windows / Apps / Win32 / API / Keyboard and Mouse Input / Winuser.h / GetKeyState():
https://learn.microsoft.com/en-us/windows/win32/ap...
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы