C# 如何为我的 .NET Windows 应用程序提供专业的外观和感觉?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1962934/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 22:14:37  来源:igfitidea点击:

How do I give professional look and feel to my .NET windows application?

c#.netwinformsuser-interface

提问by mlguy

I'm using WINFORMS not WPF.

我使用的是 WINFORMS 而不是 WPF。

I just know basic c# .net gui programming. I donot want the traditional windows look. I want to have my own custom look (eg. gtalk, antivirus softwares, media players, google chrome).

我只知道基本的 c# .net gui 编程。我不想要传统的窗户外观。我想拥有自己的自定义外观(例如 gtalk、防病毒软件、媒体播放器、谷歌浏览器)。

Actually I'm inspired by google's PICASA software. Its awesome. I want to do something like that.How can I do that? If there is something I should learn please point me.

实际上,我的灵感来自于谷歌的 PICASA 软件。这很棒。我想做这样的事情,我该怎么做?如果有什么我应该学习的,请指点我。

Also I may have to write my own custom controls (like modified tree view etc..) I guess. Please give some good learning resources.

此外,我可能必须编写自己的自定义控件(如修改后的树视图等)。我猜。请给一些好的学习资源。

回答by Marc Gravell

You want to look for +winforms +skinning. I haven't tried these, but the firsthitsdon't look bad. Most decent skinning tools will be paid for.

你想寻找+winforms +skinning。我没有试过这些,但第一次点击看起来不错。大多数体面的蒙皮工具将被支付。

回答by Tommy Carlier

There are some commercial control libraries available. I can recommend the Krypton Suite. It consists of the free Krypton Toolkit (which contains a lot of skinnable controls) and other non-free controls (Navigator, Ribbon, Docking, Workspace). It has some built-in palettes and renderers that allow you to make your UI look like Office 2010, Office 2007, Office 2003, ...

有一些商业控制库可用。我可以推荐Krypton Suite。它由免费的 Krypton Toolkit(包含许多可换肤控件)和其他非免费控件(Navigator、Ribbon、Docking、Workspace)组成。它有一些内置的调色板和渲染器,可以让你的 UI 看起来像 Of​​fice 2010、Office 2007、Office 2003 ......

回答by Graviton

You can try any of the following:

您可以尝试以下任一方法:

telerik

电传

telerik interface

电讯接口

Syncfusion

同步融合

alt text
(source: componentsource.co.jp)

替代文字
(来源:componentsource.co.jp

Or other components.

或其他组件。

They do make your UI pretty.

它们确实使您的用户界面漂亮。

Edit: if you want to study how they do it, you can buy the source code-- along with documentation and understand from there.

编辑:如果你想研究他们是如何做的,你可以购买源代码——以及文档并从那里理解。

回答by Thomas Zoechling

This articledescribes how to draw custom windows. The author also shows how to draw non-rectangular windows.

本文介绍如何绘制自定义窗口。作者还展示了如何绘制非矩形窗口。

If you could use WPF instead of Windows Forms, this is a good article about customizing window drawing:
http://www.codeguru.com/csharp/.net/net_wpf/article.php/c16379/

如果您可以使用 WPF 而不是 Windows 窗体,这是一篇关于自定义窗口绘图的好文章:http:
//www.codeguru.com/csharp/.net/net_wpf/article.php/c16379/

There is also a question with some good answers here on SO: Creating custom forms in WPF?

这里还有一个问题有一些很好的答案: 在 WPF 中创建自定义表单?

Update:
I think that skinning and custom drawing is fun to do from a programmers perspective, but I also think that there is almost no benefit for the user.
The creators of the platform you are developing for might have put a lot of effort into the design of their windowing toolkits.
If you just want to change some visual aspects of your application you also should take into account that you might miss some important other aspects of UI design:

更新:
我认为从程序员的角度来看,皮肤和自定义绘图很有趣,但我也认为对用户几乎没有任何好处。
您正在开发的平台的创建者可能在他们的窗口工具包的设计上投入了大量精力。
如果您只想更改应用程序的某些视觉方面,您还应该考虑到您可能会错过 UI 设计的其他一些重要方面:

  • consistency
  • accessibility
  • aesthetics (if you are overdoing effects, gradients, ...)
  • internationalization
  • ...
  • 一致性
  • 可达性
  • 美学(如果你过度使用效果,渐变,......)
  • 国际化
  • ...

As you are developing for Windows, you also lose the skinning ability of the OS itself. And I think that some of the skins that come with newer versions of Windows are pretty good.

当您为 Windows 开发时,您也失去了操作系统本身的换肤能力。而且我认为较新版本的 Windows 附带的一些皮肤非常好。

回答by Ucodia

From what you said, you want to develop your own custom controls. You have some frameworks for this like Qtwhich can use Direct3D for hardware accelerated graphics. It also have a Visual Studio plugin. There is a free LGPL version and a commercial version of it.

从你说的,你想开发自己的自定义控件。你有一些框架,比如Qt,它可以将 Direct3D 用于硬件加速图形。它还有一个 Visual Studio 插件。有一个免费的 LGPL 版本和一个商业版本。

I remembered about Qt because you mentioned Picasa and as far as I remember, I heard the Picasa UI has been written through Qt.

我记得 Qt 是因为你提到了 Picasa,据我所知,我听说 Picasa UI 是通过 Qt 编写的。

回答by UltraInstinct

You can try using "SetWindowRgn(..)" to set an arbitrary region for your window. This may range from giving a rounded rectangle shape to giving a weird looking shape to the form! Check this out: Link.

您可以尝试使用“SetWindowRgn(..)”为您的窗口设置任意区域。这可能包括给圆角矩形到给表格一个奇怪的形状!看看这个:链接

There is another option if you are working in Vista(aero enabled), ie you can check out DwmExtendFrameIntoClientArea(..) function here: link text

如果您在 Vista(启用航空)中工作,还有另一种选择,即您可以在此处查看 DwmExtendFrameIntoClientArea(..) 函数:链接文本

You can set the form's border style to 'none' and go on to create your custom form! You then might have to create custom buttons to carry out tasks like close, minimise, maximise etc. You might even need to write code for drag and drop events..

您可以将表单的边框样式设置为“无”,然后继续创建您的自定义表单!然后,您可能需要创建自定义按钮来执行关闭、最小化、最大化等任务。您甚至可能需要为拖放事件编写代码。

For the background, you might need to have a look at the gradient fills to give a great effect, otherwise you can use great looking pictures as Background..! But the latter option isnt good unless you have really good pic.

对于背景,您可能需要查看渐变填充以提供出色的效果,否则您可以使用漂亮的图片作为背景..!但后一种选择并不好,除非你有很好的照片。