Windows窗体会阻止每个Resx文件中的Icon [英] Windows Forms prevent Icon in every Resx file

查看:77
本文介绍了Windows窗体会阻止每个Resx文件中的Icon的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有关于Visual Studio设计器和Windows窗体项目图标的以下问题。

I have the following problem about Visual Studio designer and the Icon of Windows Forms Project.

在我的项目中(proprieties | application)我已经设置了项目的图标,之后我创建了一个"prototipe"。 form 以及其他所有形式都继承自...在这种形式中,除其他外,我设置了通过代码形式的图标(我这样做
这里因为我注意到,如果我设置图标通过设计师图标将存储在每个表单的.resx文件中,浪费大量空间和未来的困难 关于更改图标。)

In my project (proprieties | application) I've set the icon of the project, after I've created a "prototipe" form and every others forms inherit from it...in this form, among other things, I set via-code the icon of the form (I do this here because I noticed that, if I set the icon through designer the icon will be stored in .resx file of each form with a lot of space waste and future difficulties about changing the icon).

现在,如果我添加一个新表单到项目,这个新表单没有resx文件(对我来说这没关系,如果项目图标没有在表单设计器中显示没问题)但是在我将表单类型从System.Windows.Forms.Form更改为MyProjectForm和
编辑via-designer关于表单的内容(例如表单大小)Visual Studio创建.resx文件并保存表单图标。

Now, if I add a new form into the project, this new form don't have the resx file (and for me this is ok, no problem if the project icon is not showed in form designer) but after I change the form type from System.Windows.Forms.Form to MyProjectForm and edit via-designer something about the form (ex. form size) Visual Studio create .resx file with the form-icon stored.

为什么Visual Studio会这样做?我可以阻止吗?

Why Visual Studio do that? Can I prevent that?

谢谢!!!

PS

以下是我的prototipe表单的简单代码:

Here is the simple code of my prototipe form:

public class PrototipeForm : Form { protected override void OnLoad(EventArgs e) { this.Icon = Resources.ProjectWinPNG; base.OnLoad(e); } }

推荐答案

Hi Terench,

Hi Terench,

VS执行此操作以本地化您的应用程序。如果要添加任何图像或任何其他可本地化的UI元素(如文本,图像等),项目系统将生成此resx文件。

VS does this to localize your application. Project system generates this resx file, if you are adding any image or any other localizable UI element such as text, image, etc.


这篇关于Windows窗体会阻止每个Resx文件中的Icon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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