Plugins/Theme/ThemeConfig/RenderTheme.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ThemeConfig
{
public class RenderTheme
{
[DllImport("uxtheme.dll")]
public static extern int SetWindowTheme(
[In] IntPtr hwnd,
[In, MarshalAs(UnmanagedType.LPWStr)] string pszSubAppName,
[In, MarshalAs(UnmanagedType.LPWStr)] string pszSubIdList
);
public int ApplyTheme(System.Windows.Forms.Control control)
{
return this.ApplyTheme(control, "Explorer");
}
public int ApplyTheme(System.Windows.Forms.Control control, string theme)
{
try
{
if (control != null)
{
if (control.IsHandleCreated)
{
return SetWindowTheme(control.Handle, theme, null);
}
}
}
catch
{
return 0;
}
return 1;
}
public int ClearTheme(System.Windows.Forms.Control control)
{
return this.ApplyTheme(control, string.Empty);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。