我正在制作菜单。我想使用箭头键从我的列表中进行选择。
char move;
do
{
move = (char)_getch();
if (move == 38)
{
// Move Indicator Up
}
else if (move == 40)
{
// Move Indicator Down
}
}
while (move != 13);
我是否为向上和向下键使用了错误的 ascii 值?
解决了
我将 (char)_getch() 替换为 (int)_getch() 并将 char move 替换为 int move 然后将 38 和 40 替换为 ?? 和 80