Designer在单独的程序集中执行基类的Form.Load事件代码(Windows.Forms) [英] Designer executes Form.Load event code of a base class in a separate assembly (Windows.Forms)

查看:59
本文介绍了Designer在单独的程序集中执行基类的Form.Load事件代码(Windows.Forms)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


您好,

Hello,

我创建一个单独的程序集,并创建一个WinForms(基础)类。

然后我创建一个引用此程序集的应用程序。在这个应用程序中,我创建一个继承自单独程序集的基本WinForm的WinForm。

i create a separate assembly, and create a WinForms (base) class.
Then i create an application which references to this assembly. In this application i create a WinForm which inherit from the base WinForm of the separate assembly.

如果我现在打开应用程序的WinForm的设计者,则会执行Load事件代码!

例如:如果我将MessageBox.Show()放在基本WinForms的Load事件中(在单独的程序集中) - 我在设计时得到这个消息框!

If i now open the designer of the application's WinForm the Load event code gets executed!
For example: If i put a MessageBox.Show() in the Load event of the base WinForms (in the separate assembly) - i get this messagebox at design time!

据我所知,设计器反映了InitializeComponents函数,但没有执行它(或执行它的事件Oo)。

As far as i understand the designer reflects the InitializeComponents function, but does not execute it (or executes its events Oo).

像这样我无法使用基本程序集..

Like this i can't work with base assemblies..

问候语$
Yannik

Greetings
Yannik

推荐答案

通过检查
DesignMode 属性,可以排除设计时不需要的代码。也许你做了一些非特定的事情。显示有关表单,控件,事件定义的更多详细信息,
IntializeComponent

The code that is not needed at design time can be excluded by checking the DesignMode property. Maybe you did something unspecific. Show more details about the definition of the forms, controls, events, IntializeComponent.


这篇关于Designer在单独的程序集中执行基类的Form.Load事件代码(Windows.Forms)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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