关于自定义控件的click事件问题! 复盖?比较难,但你可以自己再usercontrol中增加一个事件,用于在button中click时执行这个你定义的事件,这样你的uc就会有一个button单击事件的了如果一定要做复盖,那就得做消息处理,就是控件或窗口的消息执行事件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 usercontrol定义一个事件跟定义一个属性差不多 我现在就是在uc中定义了一个自定义事件,可是如何将这个自定义事件与button的click联系起来呢?同时能够在form窗体中应用这个uc的时候我在自定义事件中自由的代码能够在单击button的click时运行???望不吝赐教! 我现在就是在uc中定义了一个自定义事件,可是如何将这个自定义事件与button的click联系起来呢?同时能够在form窗体中应用这个uc的时候我在自定义事件中自由的代码能够在单击button的click时运行???望不吝赐教! 添加一个EventHandler,然后为其添加set方法,使Click指向Button。控件:public EventHandler UIClick { set { this.button1.Click += value; } }程序:private void My_Click(object sender, EventArgs e){ //TODO: Add Click Event MessageBox.Show("well, you click me!");}MyControl myControl = new MyControl();myControl.UIClick = My_Click; public event EventHandler<EventArgs> click; private void button1_Click(object sender, EventArgs e) { this.click(sender,e); }用单击事件的时候用click就好了 private void Form1_Load(object sender, EventArgs e) { userControl11.click += new EventHandler<EventArgs>(userControl11_click); } void userControl11_click(object sender, EventArgs e) { throw new Exception("The method or operation is not implemented."); } 数组动态赋值 datalist 分页 怎么样循环每页信息 绕过浏览器的屏蔽,自动弹出新页面 非接触卡自动寻卡的问题 购物车中遇到的问题 如何判断一个文件是否为MS的excel类型的文件 菜鸟问题--如何显示提示框和确认框 晕,实在是想不出错在哪 请教double型数据输出格式的控制 如何得知当前系统使用的是大字体还是小字体? 请问C#适合开发外吗? Winform编程过时了吗/?
控件:
public EventHandler UIClick { set { this.button1.Click += value; } }
程序:
private void My_Click(object sender, EventArgs e)
{
//TODO: Add Click Event
MessageBox.Show("well, you click me!");
}
MyControl myControl = new MyControl();
myControl.UIClick = My_Click;
private void button1_Click(object sender, EventArgs e)
{
this.click(sender,e);
}用单击事件的时候用click就好了
{
userControl11.click += new EventHandler<EventArgs>(userControl11_click);
} void userControl11_click(object sender, EventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}