关于自定义控件的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."); } CL.Add("1").Add("2").Render("3");请问这种类应该怎样写? c#中能调用mfc写在dll中的控件吗? C#源码下载 高分求局域网聊天程序源代码 C#编写的数据库转换程序问题 EXE文件 谁能解答一下这种列表怎么实现的??? 一个简单的问题:如何判断一个undefined value的值?? c# winfrom程序 时时获取500W网站的彩票数据 如何自已做Windows资源管理器(关键是如何获取桌面.我的电脑的图标) C#中十六进制的整数值如何转换为十进制的整数值? 请问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.");
}