From 6a7aa9c0ff7c4c3d7cc8f8c2108ae42ef6a3e3c2 Mon Sep 17 00:00:00 2001 From: GF-Huang Date: Tue, 21 May 2024 06:22:19 +0800 Subject: [PATCH 1/2] Fix #1277. --- src/Shared/HandyControl_Shared/Controls/Window/Window.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Window/Window.cs b/src/Shared/HandyControl_Shared/Controls/Window/Window.cs index 736cf629..154e458e 100644 --- a/src/Shared/HandyControl_Shared/Controls/Window/Window.cs +++ b/src/Shared/HandyControl_Shared/Controls/Window/Window.cs @@ -61,10 +61,14 @@ namespace HandyControl.Controls #else var chrome = new WindowChrome { - CornerRadius = new CornerRadius(), - GlassFrameThickness = new Thickness(0, 0, 0, 1), UseAeroCaptionButtons = false }; + // if below Win11 22H2 + if (Environment.OSVersion.Version < new Version(10, 0, 22621, 0)) + { + chrome.GlassFrameThickness = new Thickness(0, 0, 0, 1); + chrome.CornerRadius = new CornerRadius(); + } #endif BindingOperations.SetBinding(chrome, WindowChrome.CaptionHeightProperty, new Binding(NonClientAreaHeightProperty.Name) { Source = this }); From 01f50c530b832dbe50210f12f86ae3558a72d0d8 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sat, 6 Jul 2024 16:45:17 +0800 Subject: [PATCH 2/2] chore: use the windows api to get the system version. --- src/Shared/HandyControl_Shared/Controls/Window/Window.cs | 6 ++++-- .../HandyControl_Shared/Data/Info/SystemVersionInfo.cs | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Window/Window.cs b/src/Shared/HandyControl_Shared/Controls/Window/Window.cs index 154e458e..7de0ebbe 100644 --- a/src/Shared/HandyControl_Shared/Controls/Window/Window.cs +++ b/src/Shared/HandyControl_Shared/Controls/Window/Window.cs @@ -8,6 +8,8 @@ using HandyControl.Data; using HandyControl.Tools; using HandyControl.Tools.Extension; using HandyControl.Tools.Interop; +using HandyControl.Tools.Helper; + #if NET40 using Microsoft.Windows.Shell; #else @@ -63,8 +65,8 @@ namespace HandyControl.Controls { UseAeroCaptionButtons = false }; - // if below Win11 22H2 - if (Environment.OSVersion.Version < new Version(10, 0, 22621, 0)) + + if (SystemHelper.GetSystemVersionInfo() < SystemVersionInfo.Windows11_22H2) { chrome.GlassFrameThickness = new Thickness(0, 0, 0, 1); chrome.CornerRadius = new CornerRadius(); diff --git a/src/Shared/HandyControl_Shared/Data/Info/SystemVersionInfo.cs b/src/Shared/HandyControl_Shared/Data/Info/SystemVersionInfo.cs index b6c4e165..f1de0b78 100644 --- a/src/Shared/HandyControl_Shared/Data/Info/SystemVersionInfo.cs +++ b/src/Shared/HandyControl_Shared/Data/Info/SystemVersionInfo.cs @@ -8,10 +8,9 @@ namespace HandyControl.Data; public readonly struct SystemVersionInfo { public static SystemVersionInfo Windows10 => new(10, 0, 10240); - public static SystemVersionInfo Windows10_1809 => new(10, 0, 17763); - public static SystemVersionInfo Windows10_1903 => new(10, 0, 18362); + public static SystemVersionInfo Windows11_22H2 => new(10, 0, 22621); public SystemVersionInfo(int major, int minor, int build) {