C#里头支持多重继承么?好像不行吧?
你的意思是用户控件中,放置了很多个子控件吧?
如果是这样,在控件中,绑定Label的Click事件,不就可以了么?比如,控件的初始化中加入:
this.Label1.Click += new EventHandler( this.Label1_Click );private void Label1_Click(object sender, EventArgs e){
this.OnClick( this, e );
}
你的意思是用户控件中,放置了很多个子控件吧?
如果是这样,在控件中,绑定Label的Click事件,不就可以了么?比如,控件的初始化中加入:
this.Label1.Click += new EventHandler( this.Label1_Click );private void Label1_Click(object sender, EventArgs e){
this.OnClick( this, e );
}
{
if(Click!=null)
Click(this,e);
}再接下来,为每个你创建的LABEL、BUTTON控件定义一个CLICK事件委托:private void Label1_Click(object sender,EventArgs e)
{
OnClick(e);
}其它的控件,在事件类型一致的情况下可以使用同一个委托。