Skinnable Windows Forms App: Handle different icon sets

帅比萌擦擦* 提交于 2019-12-12 02:48:01

问题


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.

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?


回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/8974801/skinnable-windows-forms-app-handle-different-icon-sets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!