手动创建表单 [英] Manually creating a form

查看:74
本文介绍了手动创建表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我想重新创建一个仅提供资源文件的表单。我打算

只需阅读资源文件并重新创建表格即可。对象及其所有

控件在此文件中找到(应用文件中的所有属性和

依赖于未找到的默认属性)。看了

" InitializeComponent()"然而(这就是我真正想要在这里重新制作的b $ b),可以解释为什么这个函数会执行以下操作:


1)手动设置名称每个控件的属性都会覆盖资源文件本身中找到的相同属性(尽管名称是

相同 - 但它应该完全依赖于资源文件)。例如,在*从资源文件中读取相同的值后,我在代码*中看到这个




this.MyButton.Name =" MyButtonName" ;;


2)偶尔会在代码中添加其他属性,例如:


this.MyButton.UseVisualStylebackColor = true

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;




如何知道应用上述属性并且可能

其他所有你拥有的资源文件是什么?此外,还有一个更合适(官方)的方式从其资源生成表单

文件(手动执行它是单调乏味且容易出错)。谢谢。

解决方案

当您在窗体上拖动控件或设置其

属性时,会生成这些代码。今天VB.NET有一个名为VB.NET 2005 Express的免费工具,为什么

担心从资源文件中重现表单?


chanmm

" Jake Forson" < no_spam@_nospam.com>在消息中写道

新闻:Ou ************** @ TK2MSFTNGP05.phx.gbl ...

你好,

我想重新创建一个只给出资源文件的表单。我打算简单地阅读资源文件并重新创建表格。对象及其在此文件中的所有控件(应用文件中的所有属性,并依赖于未找到的属性的默认属性)。在查看
InitializeComponent()之后然而(这是我真正想要在这里重新制作的东西),可以解释为什么这个功能会做到以下几点:

1)手动设置名称。每个控件的属性都会覆盖资源文件本身中找到的相同属性(尽管名称相同 - 但它应该完全依赖于资源文件)。例如,在*从资源文件中读取相同的值之后,我在代码*中看到了这个:

this.MyButton.Name =" MyButtonName";

2)偶尔在代码中添加其他属性,例如:

this.MyButton.UseVisualStylebackColor = true
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
等。

任何人都应该知道如何应用上述属性和
当你拥有的资源文件时可能是其他人吗?
此外,是否有更合适的(官方)从资源文件生成表单的方法(手动执行它很繁琐且容易出错)。
谢谢。



< BLOCKQUOTE>>在窗体上拖动控件或设置其

属性时,将生成这些代码。今天VB.NET有一个名为VB.NET 2005 Express的免费工具,为什么
担心从资源文件中重现表单?




我的应用程序需要它。


我有一些类似的要求,但我从未理解该资源

文件是表单设计的完整表示。我以为他们只是用于本地化的
。是否有一些文件部分我错过了

并且应该阅读?


Jake Forson < no_spam@_nospam.com>在消息中写道

新闻:Ou ************** @ TK2MSFTNGP05.phx.gbl ...

你好,

我想重新创建一个只给出资源文件的表单。我打算简单地阅读资源文件并重新创建表格。对象及其在此文件中的所有控件(应用文件中的所有属性,并依赖于未找到的属性的默认属性)。在查看
InitializeComponent()之后然而(这是我真正想要在这里重新制作的东西),可以解释为什么这个功能会做到以下几点:

1)手动设置名称。每个控件的属性都会覆盖资源文件本身中找到的相同属性(尽管名称相同 - 但它应该完全依赖于资源文件)。例如,在*从资源文件中读取相同的值之后,我在代码*中看到了这个:

this.MyButton.Name =" MyButtonName";

2)偶尔在代码中添加其他属性,例如:

this.MyButton.UseVisualStylebackColor = true
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
等。

任何人都应该知道如何应用上述属性和
当你拥有的资源文件时可能是其他人吗?
此外,是否有更合适的(官方)从资源文件生成表单的方法(手动执行它很繁琐且容易出错)。
谢谢。



Hi there,

I''d like to re-create a form given only its resource file. I was going to
simply read the resource file and re-create the "Form" object and all its
controls as found in this file (applying all properties in the file and
relying on the default properties for those not found). After looking at
"InitializeComponent()" however (which is what I''m really trying to
re-produce here), can somone explain why this function does the following:

1) Manually sets the "Name" property for each control which overwrites the
same property found in the resource file itself (athough the names are the
same - it should rely solely on the resource file however). E.g., I see this
in code *after* reading the same value from the resource file:

this.MyButton.Name = "MyButtonName";

2) Occasionally adds other properties in code such as:

this.MyButton.UseVisualStylebackColor = true
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
etc.

How is anyone supposed to to know to apply the above properties and possibly
others when all you have is the resource file to work with? Moreover, is
there a more appropriate (official) way to generate a form from its resource
file (manually doing it is tedious and error prone). Thanks.

解决方案

Those code is generated when you drag a control on a form or set its
properties. Today VB.NET has a free tool called VB.NET 2005 Express so why
worry to reproduce the form from the resource file?

chanmm
"Jake Forson" <no_spam@_nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...

Hi there,

I''d like to re-create a form given only its resource file. I was going to
simply read the resource file and re-create the "Form" object and all its
controls as found in this file (applying all properties in the file and
relying on the default properties for those not found). After looking at
"InitializeComponent()" however (which is what I''m really trying to
re-produce here), can somone explain why this function does the following:

1) Manually sets the "Name" property for each control which overwrites the
same property found in the resource file itself (athough the names are the
same - it should rely solely on the resource file however). E.g., I see
this in code *after* reading the same value from the resource file:

this.MyButton.Name = "MyButtonName";

2) Occasionally adds other properties in code such as:

this.MyButton.UseVisualStylebackColor = true
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
etc.

How is anyone supposed to to know to apply the above properties and
possibly others when all you have is the resource file to work with?
Moreover, is there a more appropriate (official) way to generate a form
from its resource file (manually doing it is tedious and error prone).
Thanks.



> Those code is generated when you drag a control on a form or set its

properties. Today VB.NET has a free tool called VB.NET 2005 Express so why
worry to reproduce the form from the resource file?



My application requires it.


I have a somewhat similar requirement, but I never understood that resource
files to be a full representation of a form''s design. I thought they were
just used for localization. Is there some documentation section I missed
and should read?

"Jake Forson" <no_spam@_nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...

Hi there,

I''d like to re-create a form given only its resource file. I was going to
simply read the resource file and re-create the "Form" object and all its
controls as found in this file (applying all properties in the file and
relying on the default properties for those not found). After looking at
"InitializeComponent()" however (which is what I''m really trying to
re-produce here), can somone explain why this function does the following:

1) Manually sets the "Name" property for each control which overwrites the
same property found in the resource file itself (athough the names are the
same - it should rely solely on the resource file however). E.g., I see
this in code *after* reading the same value from the resource file:

this.MyButton.Name = "MyButtonName";

2) Occasionally adds other properties in code such as:

this.MyButton.UseVisualStylebackColor = true
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
etc.

How is anyone supposed to to know to apply the above properties and
possibly others when all you have is the resource file to work with?
Moreover, is there a more appropriate (official) way to generate a form
from its resource file (manually doing it is tedious and error prone).
Thanks.



这篇关于手动创建表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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