我有一个有标签字段的类。现在我想从该标签中获取该类的引用。我怎样才能做到这一点?这就是我所拥有的。
public class Abc
{
Label l;
}
public partial class Form1 : Form
{
private void btnins_Click(object sender, EventArgs e)
{
Abc ob=new Abc();
ob.l=new new Label();
l.Text="Right Click Me";
l.ContextMenuStrip = cntxtdelmnu;
}
private void cntxtdelnode_Click(object sender, EventArgs e)
{
Label lbl= (Label)cntxtdelmnu.SourceControl;
//Here I have to get the reference of ob using lbl.
}
}