将自定义组件拖动到表单时,如何向源类添加源代码? [英] How do I add source code to class when custom component is dragged to form?

查看:65
本文介绍了将自定义组件拖动到表单时,如何向源类添加源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当自定义组件拖到表单上时,是否有人知道如何将自定义源代码添加到类或子例程中?



例如:



当您将ReportViewer控件拖到表单上时,此代码会自动添加到主表单加载子例程:



Me.ReportViewer1.RefreshReport()



我希望我的自定义控件在拖动到表单上时自动将几行代码添加到我的表单加载子例程中。



提前致谢!

Does anyone know how to add custom source code to a class or subroutine when a custom component is dragged onto a form?

For example:

When you drag a ReportViewer control onto a form this code is added to the main form load sub routine automatically:

Me.ReportViewer1.RefreshReport()

I want my custom control to automatically add a few lines of code to my form load sub routine when it is dragged onto the form.

Thanks in advance!

推荐答案

你没有。



你最好得到的是当你在表单上删除一个控件时,Designer可以生成简单的代码来设置控件的某些属性,具体取决于你在编写时在属性上设置的属性控件。



此代码最终在表单设计器生成的代码文件中。
You don't.

The best you're going to get is when you drop a control on a form the Designer can generate simple code to set certain properties of the control, depending on the attributes set on the properties when you write the control.

This code ends up in the forms designer generated code file.


这篇关于将自定义组件拖动到表单时,如何向源类添加源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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