设计师定制按钮thorws错误 [英] customised button thorws error on designer

查看:118
本文介绍了设计师定制按钮thorws错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好伙伴,

我创建了自己的按钮,其中有一个额外的按钮。

I have created my own button witch has one extra button in it.

我无法正确添加按钮单击甚至表单设计器,所以我去了代码并手动添加。

I could not properly add button click even form designer so i went to the code and added it manually.

这是我的按钮的样子

class _customButton: _mybutton{
      public Button _button = new Button();
       public _customButton(){             
            Controls.Add(_button);           
        }}

添加代码:

this.customButtonSend._button.Click += new System.EventHandler(this.customButtonSend_button_Click);

这是我的函数:

 private void customButtonSend_button_Click(object sender, EventArgs e){
            addTo_console("did it!"); }

我在设计师中遇到此错误:

and i get this error in designer:

严重性    代码    描述    项目    文件    线    抑制状态

消息        无法在传递给事件绑定服务的对象上设置事件,因为无法找到与该对象关联的站点。        Path..\Form1.Designer.cs     541  
 

Severity    Code    Description    Project    File    Line    Suppression State
Message        Events cannot be set on the object passed to the event binding service because a site associated with the object could not be located.        Path..\Form1.Designer.cs    541    

所有我真正需要做的就是忽略它,但我是 确定背后隐藏着更大的问题。

all i really had to do was ignore it but I am  sure there is hidden bigger problem behind it.

Thx任何帮助。

推荐答案

到目前为止,我发现只有很好的解决方案才能将它添加到Form_Load中,但我的问题是我是否可以将它添加到FOrm 1.Desifner.cs中以在控件属性中查看它。
so far only good solution i found to add it to the Form_Load but my quesiton is if i can add it to the FOrm 1.Desifner.cs to see it in the control porperties.


这篇关于设计师定制按钮thorws错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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