Re: [问题] USERCONTROL取值

楼主: TameFoxx (foxx)   2015-11-23 23:26:45
UCC:
public EventHandler btnclickFromUCC;
private void button1_Click(object sender, EventArgs e)
{
btnclickFromUCC.Invoke(sender, e);
}
UCB:
public UCB()
{
UCC.btnclickFromUCC+=btnfromUCC;
}
public EventHandler btnclickFromUCB;
private void btnfromUCC(object sender, EventArgs e)
{
btnclickFromUCB.Invoke(sender, e);
}
UCA:
public UCA()
{
UCB.btnclickFromUCB+=btnfromUCB;
}
private void btnfromUCB(object sender, EventArgs e)
{
if(panel.Visible)
panel.Visible=false;
else
panel.Visible=True;
}
楼主: TameFoxx (foxx)   2015-11-23 23:31:00
或者简单一点 将UCC在UCB中的宣告设为public然后UCA直接把自己的panel传给UCC
作者: bernachom (Terry)   2015-11-24 06:50:00
谢谢前辈,我今天试一下,谢谢您

Links booklink

Contact Us: admin [ a t ] ucptt.com