Set same icon for all my Forms

前端 未结 8 1532
一向
一向 2020-12-08 19:31

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 project

8条回答
  •  旧时难觅i
    2020-12-08 19:59

    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.

    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.

提交回复
热议问题