获取 Windows 主题?

Ver*_*cas 4 .net themes windows-themes

我必须真正知道我的用户正在使用哪个 Windows 主题。
更准确地说,是 Classic、XP、Basic 或 Aero。(Vista/7 Windows Basic 主题中的基本主题)
我已经知道如何查找它是否是 aero,但是其他的呢?


答案可以是任何 .NET 语言(C#、VB.NET 或 C++)。


如果您确实必须知道为什么我需要了解主题,那么您就可以了:
我在表单标题上有一些浮动按钮,我需要根据 Windows 主题更改它们的外观。
到目前为止,我已经找到了 Aero/Classic。


解决问题后的结果屏幕截图: 最小化到托盘按钮

She*_*Pro 5

您可以在以下位置检查当前主题的注册表:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes

在字符串“CurrentTheme”下,它具有当前主题的路径。下面是在 C# 中检查它的代码。

using Microsoft.Win32;

public string GetTheme()
{
  string RegistryKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes";
  string theme;
  theme = (string) Registry.GetValue(RegistryKey, "CurrentTheme", string.Empty);
  theme = theme.Split('\\').Last().Split('.').First().ToString();
  return theme;
}
Run Code Online (Sandbox Code Playgroud)