代码:
private UserLookAndFeel userLookAndFeel;
public MainGeneral()
{
InitializeComponent();
// 创建 UserLookAndFeel 实例
userLookAndFeel = new UserLookAndFeel(this);
// 订阅 StyleChanged 事件
userLookAndFeel.StyleChanged += UserLookAndFeel_StyleChanged;
}
private void UserLookAndFeel_StyleChanged(object sender, EventArgs e)
{
// 在这里处理样式变化事件
// 弹出修改后皮肤的名字
MessageBox.Show($"当前皮肤名字:{userLookAndFeel.ActiveSkinName}
\n 当前皮肤是否是CompactUIModeForced:{userLookAndFeel.CompactUIModeForced}
\n 当前皮肤配色名称:{userLookAndFeel.ActiveSvgPaletteName}");
}
触发效果: