我想将一个参数传递给我试图用这段代码实现的事件处理程序:
private void openInputImagesToolStripMenuItem_Click(object sender, EventArgs e)
{
...
pb.MouseDoubleClick += new MouseEventHandler((sender,e) => showLargeImage(sender,e,imageIndex));
}
private void showLargeImage(object sender, MouseEventArgs e, int imageIndex)
{
...
}
但是,适配器内的“sender”和“e”变量出现错误:
A local variable named 'sender' cannot be declared in this scope because it would give a different meaning to 'sender', which is already used in a 'parent or current' scope to denote something else.
A local variable named 'e' cannot be declared in this scope because it would give a different meaning to 'sender', which is already used in a 'parent or current' scope to denote something else.
我该如何解决这个问题?