私は次のコードを持っています(簡略化):
private ContextMenuStrip createContextMenuStrip(Card card)
{
ContextMenuStrip cms = new ContextMenuStrip();
cms.Items.Add("Send to the top of the deck", null, sendToDeck);
return cms;
}
public void sendToDeck(object sender, EventArgs e)
{
// **
}
クラスCardには type のメンバーがありPictureBoxます。このPictureBox上に、ContextMenuが作成されます。これはこれまでのところ完全に機能しますが、次のようになります。
ここでは、クリックされた PictureBox の を含む対応する Card クラスのインスタンスにアクセスしますContextMenu。
これを達成するためにどのような可能性が必要ですか?