“自定义控件内部子控件”事件如何传递到主控件?
我在使用自定义控件Click事件是发现点击自定义控件内控件不会触发自定义控件Click事件,觉得应该是控件参数没有传递到自定义控件事件内,请问如何把自定义控件内子控件Click事件参数传递到自定义控件Click事件?
private void ledViewSub_MouseClick(object sender, MouseEventArgs e)
{
ledViewMain_MouseClick(sender,e);
}
private void ledViewMain_MouseClick(object sender, MouseEventArgs e)
{
}
可是没有立即响应!
先要做效果,点击自定义控件任何位置,隐藏包含自定义控件的panel。
实际是只有自定义控件非子控件位置点击才有效果!
private void ledViewMain1_MouseClick(object sender, MouseEventArgs e)
{
this.panel.Visible = false;
this.pictureBox.Visible = true;
}
private void ledViewSub_MouseClick(object sender, MouseEventArgs e)
{
ledViewMain_MouseClick(sender,e);
}
private void ledViewMain_MouseClick(object sender, MouseEventArgs e)
{
}
可是没有立即响应!
先要做效果,点击自定义控件任何位置,隐藏包含自定义控件的panel。
实际是只有自定义控件非子控件位置点击才有效果!
private void ledViewMain1_MouseClick(object sender, MouseEventArgs e)
{
this.panel.Visible = false;
this.pictureBox.Visible = true;
}
...全文
相关推荐
为C#自定义控件添加自定义事件
这里的自定义控件是由普通控件组合而成的。 希望事件响应代码推迟到使用自定义控件的窗体里写。 步骤一:新建一个用户控件,放两个按钮,Tag分别是btn1,btn2. 这两个按钮的共用单击事件处理代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Form
C# 自定义 事件 和 触发自定义事件,显示子窗体传过来的值
C# 自定义 事件 和 触发自定义事件,显示子窗体传过来的值,窗体间响应很有用哦,分享有道。
MFC中如何使用子控件向父控件发送自定义消息
MFC中如何使用子控件向父控件发送自定义消息
c# winform 用子窗体刷新父窗体,子窗体改变父窗体控件的值
NULL 博文链接:https://heisetoufa.iteye.com/blog/382684
C#中父窗口和子窗口之间实现控件互操作
C#中父窗口和子窗口之间实现控件互操作C#中父窗口和子窗口之间实现控件互操作


