我有 2 个问题。
第一个主要问题是如何解决我在尝试调用包含
KeyEventArgs e
作为参数的方法时遇到的错误。我只知道当参数是变量时如何处理它们。第二个只是一个简单的问题,如果
while
循环会这样做,程序在打印文本(标签)之前等待(keydown)namespace Test2014 { public partial class Form1 : Form { List<Action> methods = new List<Action>(); public Form1() { InitializeComponent(); // 1. Error invalid arguments methods.Insert(0, test); // 1. passing ( KeyEventArgs e ) as argument ? } private void button1_Click(object sender, EventArgs e) { methods[0].Invoke(); } void test(KeyEventArgs e) // 1. passing ( KeyEventArgs e ) as argument ? { while (true) { if (e.KeyCode == Keys.A) // 2. do this work as wait for keydown before moving down ? break; } // 2. label_test.Text = "When Loop is broken (key down(A)) change this label"; } } }