可换肤的Windows窗体应用程序:处理不同的图标集 [英] Skinnable Windows Forms App: Handle different icon sets

查看:137
本文介绍了可换肤的Windows窗体应用程序:处理不同的图标集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们开始时,我们将所有图标放在源代码管理中的文件夹中,并且所有Windows窗体项目都从 .resx 文件中引用该文件夹中的图标。

When we started, we put all icons inside a folder in source control, and all Windows Forms projects reference icons inside that folder from their .resx file.

既然我们决定使用不同的GUI,我们又创建了两个图标集,每个图标集都有相同的名称,每个图标集都放在自己的文件夹中,这样当我们想要使用不同的文件夹时一,我们只是复制并粘贴到main文件夹中。

Now that we decided to have different-looking GUIs, we created two more icon sets, all with same names, each into its own folder, so that when we want to use a different one, we just copy and paste into the "main" folder.

这种方法的问题是源代码控制:每当我们提交时,我们必须小心不要发送我们的图标,如果我们改变它们。这非常麻烦。

The problem with this approach is source control: whenever we commit, we must be careful not to send our icons, if we changed them. This is very bothersome.

如何将所有图标保持在源代码管理之下,如何避免这种情况?有没有一种标准的方法来处理这个?

How can this be avoided, while keeping all icons under source control? Is there a standard way to handle this?

推荐答案

有一个配置标志,指​​示哪个集合要使用的图标。然后,您只需将工作区配置为指向正确的工作区,而不是踩踏彼此的图标集。

Have a configuration flag that indicates which set of icons to use. Then, instead of stomping on each other's icon sets, you only need to configure your workspace to point at the correct one.

防止配置文件互相踩踏在VC中,让VC存储具有合理默认值的配置文件的模板,然后让VC系统忽略实际配置文件。

To keep from having config files stomping on each other in VC, have the VC store a template of the config file with sensible default values, and then have the actual config file be ignored by the VC system.

例如,我们将 web.config.template 签入VC系统并进行任何系统范围的配置更改那里。每个开发人员(以及任何其他类型的部署)都将拥有自己的模板文件副本及其特定的配置需求。

For example, we will have web.config.template checked in to the VC system and make any system-wide config changes in there. Each developer (and any other sort of deployment) will have their own copy of the template file with their specific config needs in it.

帮助了解主配置何时文件已被更改,我们有一组钩子脚本,通知用户已对本地文件进行了更改和自动差异,并且在更改主文件时需要设置显式标志。

To assist with knowing when the master config file has been changed, we have a set of hook scripts that notify the user that there have been changes and auto-diff against the local file, as well as requiring explicit flags to be set when changing the master file.

这篇关于可换肤的Windows窗体应用程序:处理不同的图标集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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