Demo.WindowsForms/BSE.Windows.Forms/XPander/DisplayInformation.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.IO;
using System.Text.RegularExpressions;
namespace BSE.Windows.Forms
{
static class DisplayInformation
{
#region FieldsPrivate
[ThreadStatic]
private static bool m_bIsThemed;
private const string m_strRegExpression = @".*\.msstyles$";
#endregion
#region Properties
internal static bool IsThemed
{
get { return m_bIsThemed; }
}
#endregion
#region MethodsPrivate
static DisplayInformation()
{
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(DisplayInformation.OnUserPreferenceChanged);
DisplayInformation.SetScheme();
}
private static void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
DisplayInformation.SetScheme();
}
private static void SetScheme()
{
if (VisualStyleRenderer.IsSupported)
{
if (!VisualStyleInformation.IsEnabledByUser)
{
return;
}
StringBuilder stringBuilder = new StringBuilder(0x200);
int iResult = NativeMethods.GetCurrentThemeName(stringBuilder, stringBuilder.Capacity, null, 0, null, 0);
if (iResult == 0)
{
Regex regex = new Regex(m_strRegExpression);
m_bIsThemed = regex.IsMatch(Path.GetFileName(stringBuilder.ToString()));
}
}
}
后面还有 9 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
