Windows 的 System.Control 是什么颜色?(Visual Studio 设计视图)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2637886/
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
What Color is the Windows' System.Control? (Visual Studio Design View)
提问by jp2code
In Visual Studio Design View, the selection of Form Colors in the Properties Pane are selectable from the "Custom", "Web", and "System" tabs. Of course, the color number can be used, too.
在 Visual Studio 设计视图中,可以从“自定义”、“Web”和“系统”选项卡中选择“属性”窗格中的表单颜色。当然,也可以使用色号。
When the "System" Tab is selected, the colors in the list depend on what type of Theme the Computer User has set on the PC.
选择“系统”选项卡后,列表中的颜色取决于计算机用户在 PC 上设置的主题类型。
I'd like to stick with this, but I need to know how to "read in" the colors. I have controls that I create "on-the-fly" or often need to change a color back after getting the person's attention using a blink/flicker technique.
我想坚持这一点,但我需要知道如何“读入”颜色。我有我“即时”创建的控件,或者在使用眨眼/闪烁技术引起人们的注意后经常需要更改颜色。
How do I get the list of System Theme colors?
如何获取系统主题颜色列表?
Most forms have a BackColor that defaults to "Control", which looks like a very light gray under Windows 7, running the default Windows 7 Theme.
大多数表单都有一个默认为“Control”的 BackColor,它在 Windows 7 下看起来像一个非常浅的灰色,运行默认的 Windows 7 主题。
I've managed to grab a color by physically reading the ARGB value in code, but I'd rather have a way to access the colors by their Theme Name, if that can be done.
我已经设法通过物理读取代码中的 ARGB 值来获取颜色,但如果可以的话,我宁愿有一种方法通过它们的主题名称访问颜色。
public Form1()
{
Color cControl = this.BackColor;
Console.WriteLine(cControl.Name); // there is not always a name!
}
Does anyone know what I'm talking about?
有谁知道我在说什么?
回答by lxalln
From the sounds of your question, you're looking for:
从您的问题的声音中,您正在寻找:
System.Drawing.SystemColorswhich will give you a full list of the system colors by name.
System.Drawing.SystemColors它将按名称为您提供系统颜色的完整列表。