用其他方法发送控制 [英] send control in other method

查看:63
本文介绍了用其他方法发送控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨freind's。



i希望发送控制用户cntrol方法点击按钮?



我的项目是winform。



用户控制项目是外部项目(项目测试)。

项目主要用户控制负载。 (在项目主体中加载项目测试)



并在新标签中加载所需的数字。



样本图片:[ ^ ]。



示例视频:[ ^ ]。

解决方案

OP重新定位到原始问题的内容被不恰当地发布为解决方案。

在您的用户控件中公开声明一个事件处理程序。如果您希望在用户控件上调用此处理程序的按钮单击事件时传递您的用户控件,请调用相同的事件。



声明:

公共EventHandler处理程序; 





致电:



 受保护  void  btn_Click ( object  sender,EventArgs e)
{
...
handler(sender,e);
......
}





现在你可以将它用作你的usercontrol上的事件你正在使用它的表格......


hi freind's.

i want send control user cntrol in method click buttom?

MY project is winform.

user control project is external project(project test).
user control load in project main. (load project test in project main)

And load in a new tab to the desired number.

sample picture: [^].

sample video: [^].

解决方案

Content inappropriately posted as a "solution" by the OP relocated to the original question.


Declare an event handler publicly to do so in your user control. call the same in the event through which you want to pass it suppose you want to pass your user control on click event of button on your user control call this handler.

Declaration :

public EventHandler handler;



Call:

protected void btn_Click(object sender, EventArgs e)
        {
...
            handler(sender, e);
            ......
        }



Now you can use this as an event with your usercontrol on the form you are using it...


这篇关于用其他方法发送控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆