我所有的表格设置相同的图标 [英] Set same icon for all my Forms

查看:135
本文介绍了我所有的表格设置相同的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法来设置相同的图标,我的所有形式,而不必更改逐个?
喜欢的东西,当你设置 GlobalAssemblyInfo 您的解决方案内的所有项目。

Is there any way to set the same icon to all my forms without having to change one by one? Something like when you setup GlobalAssemblyInfo for all your projects inside your solution.

推荐答案

一个办法是从一个共同的基础表格的(大概从RESX)设置图标在构造函数中继承。另一种选择可能是 PostSharp - 现在看来似乎应该是可能通过AOP来做到这一点(设置.Icon);不是小事,虽然。最后,你可以使用一个简单的工具方法(可能是扩展方法)做相同的。

One option would be to inherit from a common base-Form that sets the Icon in the constructor (presumably from a resx). Another option might be PostSharp - it seems like it should be possible to do this (set .Icon) via AOP; not trivial, though. Finally, you could use a simple utility method (perhaps an extension method) to do the same.

最重要的是,与第一个选项,你很可能冒险一<大骨节病>控制 + <大骨节病> ^ h (全部替换)从:表单:System.Windows.Forms的。表格:MyCustomForm

Best of all, with the first option, you could probably risk a Ctrl+H (replace all) from : Form or : System.Windows.Forms.Form to : MyCustomForm.

这篇关于我所有的表格设置相同的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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