我自定义了一个控件TextBoxIP
添加了自定义事件IPBoxValueChanged 
可以在调用form中添加下面代码实现这个事件
this.TextBoxIP.IPBoxValueChanged += new TextBoxChangedHandle(TextBoxIP_UserControlValueChanged);不过我想在自定义控件属性栏中添加这个事件,双击可以自动添加上面的命令,就像c#添加其他事件一样,如何实现啊??谢谢各位高手啦

解决方案 »

  1.   

    在控件中声明一下这个事件如果要实现双击控件,自动产生
    this.TextBoxIP.IPBoxValueChanged += new TextBoxChangedHandle(TextBoxIP_UserControlValueChanged); 则给IPBoxValueChanged事件贴上 DefaultEvent 标签
      

  2.   

    写个委托即可,if(event != null){//code}
      

  3.   

    yzlxy:如果要实现双击控件,自动产生 不是双击控件大概我没说清楚,我是想在自定义控件属性栏中出现我新添加的这个事件,跟原来那些mouseDown等等放在一起,双击的时候也可以在designer中自动添加this.TextBoxIP.IPBoxValueChanged += new TextBoxChangedHandle(TextBoxIP_UserControlValueChanged);  以及TextBoxIP_UserControlValueChanged{}方法,可以在其中添加自己的代码。就像原有那些mouseDown事件一样。如何实现啊?要修改设计器?
      

  4.   

    那更简单了啊,声明一个事件参数,然后像changjiangzhibin写的那么调用