当我单击向下箭头时,它卡在第二个选择上并且向上或向下不再起作用,我该如何解决?
第二个问题:更改菜单项时如何防止冻结?当我更改菜单项时,它会冻结第二个选择。这是有关此问题的代码;
keyboard = Keyboard.GetState();
mouse = Mouse.GetState();
if (keyboard.IsKeyUp(Keys.Up) && prevKeyboard.IsKeyDown(Keys.Down))
{
if (selected > 0) selected--;
else selected.Equals(buttonList.Count - 1);
}
if (keyboard.IsKeyUp(Keys.Up) && prevKeyboard.IsKeyDown(Keys.Down))
{
if (selected < buttonList.Count - 1) selected++;
else selected.Equals(0);
}
prevMouse = mouse;
prevKeyboard = keyboard;
}