Windows 窗体应用程序 C# 样式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18596434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows Forms Application C# Style
提问by StackJon
I am developing a Windows Form Application in Visual Studio 2008 (C#) And I want to add Style to the items.
我正在 Visual Studio 2008 (C#) 中开发 Windows 窗体应用程序,并且我想为项目添加样式。
I have been investigating a few ideas about it but I have not found an example about how to do it. Is it really possible?
我一直在研究一些关于它的想法,但我还没有找到一个关于如何去做的例子。真的有可能吗?
My app looks like:
我的应用程序看起来像:
But I really want to add more style in buttons, textboxs and other items I have:
但我真的想在按钮、文本框和我拥有的其他项目中添加更多样式:
My boss insists on using Visual Studio 2008.
我的老板坚持使用 Visual Studio 2008。
采纳答案by Gareth
To do this without purchasing anything else, you could create your own custom button and text box controls, either from scratch or as controls derived from the existing windows forms controls and then overriding OnPaint etc. Take a look at what's been done here:
要在不购买任何其他东西的情况下做到这一点,您可以从头开始创建自己的自定义按钮和文本框控件,或者作为从现有 Windows 窗体控件派生的控件,然后覆盖 OnPaint 等。看看这里做了什么:
http://dotnetrix.co.uk/button.htm
http://dotnetrix.co.uk/button.htm
You could also investigate third party options.
您还可以调查第三方选项。
Or, use WPF if that's a possibility as others have said. I'd push for WPF! If there's an existing WinForms Code base you can always host WPF Elements in WinForms. See:
或者,如果像其他人所说的那样有可能,请使用 WPF。我会推动 WPF!如果有现有的 WinForms 代码库,您始终可以在 WinForms 中托管 WPF 元素。看:
Walkthrough: Hosting a Windows Presentation Foundation Control in Windows Forms
回答by Bassam Alugili
IF you wana to use Winforms than you have to buy this one for example:
如果您想使用 Winforms,那么您必须购买这个,例如:
http://devcomponents.com/You have to bind the new assemblies in your application that is not a lot of work!
http://devcomponents.com/你必须在你的应用程序中绑定新的程序集,这不是很多工作!
But better way do that with WPF http://wpftutorial.net/DataGrid.html
但更好的方法是使用 WPF http://wpftutorial.net/DataGrid.html