当我在我的项目中按下一个picturebox时,我联系方法card_pressed。 通过这个代码C#发件人问题
this.picturebox.Click += new System.EventHandler(this.card_Pressed)
我有几个pictureboxes所有链接到这个方法,现在我想检查已经通过该方法发送者接触,并比较它在PictureBox的名称压制。
if(sender == picturebox1)
{
//something
}
我得到这个工作时,即时通讯使用按钮,但不是当我使用图片盒时,为什么?
谢谢!
工作的呢? :'if(object.Equals(sender,picturebox1))' – Omer 2011-06-11 14:46:21
try ** if((picturebox)sender == picturebox1)** – 2011-06-11 14:49:18
我们需要**更多信息**。您发布的代码*工作*,错误必须在其他地方。 – 2011-06-11 14:54:46