在 .NET 中获取默认的 Windows 系统颜色 [英] Get default Windows System Colors in .NET

查看:36
本文介绍了在 .NET 中获取默认的 Windows 系统颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个自定义 Button 控件,作为(即将推出)免费控件套件的一部分,并且我想将我的(默认)控件颜色基于相应的 Windows 系统颜色.因此,在在线查找默认 Windows 系统颜色"后,我找不到有关 Windows 控件(尤其是按钮控件)的系统颜色的信息.

I'm writing a custom Button control as part of a (soon to be) free Control suite, and I would like to base my (default) Control colors on the corresponding Windows System colors. So, after looking up "default windows system colors" online I could not find information on the System Colors for Windows controls (especially not Button controls).

有没有办法在 .NET 中获取这些颜色信息(例如按钮边框颜色、按钮高亮颜色、按钮悬停颜色、按钮点击背景颜色等)?

Is there a way to get this color information (e.g. Button Border Color, Button Highlight Color, Button Hover Color, Button Clicked Background Color, etc) in .NET?

推荐答案

是的.事实上,有一整个类专门用于此:

Yes. In fact, there is an entire class dedicated to this:

SystemColors 类.

...或者对于 WPF(感谢@ORMapper),System.Windows.SystemColors 类.

...or for WPF (thanks @ORMapper), The System.Windows.SystemColors class.

这篇关于在 .NET 中获取默认的 Windows 系统颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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