Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get default Windows System Colors in .NET

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).

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?

like image 961
jay_t55 Avatar asked Sep 01 '14 10:09

jay_t55


2 Answers

There is a System Color Class out, which will provide you the Colors.

For WinForms use:

System.Drawing.SystemColors

For WPF use:

System.Windows.SystemColors

like image 163
Mark Avatar answered Oct 18 '22 12:10

Mark


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

The SystemColors class.

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

like image 22
Simon Whitehead Avatar answered Oct 18 '22 14:10

Simon Whitehead