diff --git a/clashN/clashN/ViewModels/MainWindowViewModel.cs b/clashN/clashN/ViewModels/MainWindowViewModel.cs index 55454b4..61fce7a 100644 --- a/clashN/clashN/ViewModels/MainWindowViewModel.cs +++ b/clashN/clashN/ViewModels/MainWindowViewModel.cs @@ -14,6 +14,7 @@ using System.Reactive; using System.Reactive.Linq; using System.Windows; using System.Windows.Forms; +using System.Windows.Interop; using Application = System.Windows.Application; namespace clashN.ViewModels @@ -472,18 +473,20 @@ namespace clashN.ViewModels if (_config.uiItem.mainWidth > 0 && _config.uiItem.mainHeight > 0) { - if (_config.uiItem.mainWidth > SystemInformation.WorkingArea.Width) - { - _config.uiItem.mainWidth = SystemInformation.WorkingArea.Width * 2 / 3; - } - if (_config.uiItem.mainHeight > SystemInformation.WorkingArea.Height) - { - _config.uiItem.mainHeight = SystemInformation.WorkingArea.Height * 2 / 3; - } - Application.Current.MainWindow.Width = _config.uiItem.mainWidth; Application.Current.MainWindow.Height = _config.uiItem.mainHeight; } + + IntPtr hWnd = new WindowInteropHelper(Application.Current.MainWindow).EnsureHandle(); + Graphics g = Graphics.FromHwnd(hWnd); + if (Application.Current.MainWindow.Width > SystemInformation.WorkingArea.Width * 96 / g.DpiX) + { + Application.Current.MainWindow.Width = SystemInformation.WorkingArea.Width * 96 / g.DpiX; + } + if (Application.Current.MainWindow.Height > SystemInformation.WorkingArea.Height * 96 / g.DpiY) + { + Application.Current.MainWindow.Height = SystemInformation.WorkingArea.Height * 96 / g.DpiY; + } } private void StorageUI() { diff --git a/clashN/clashN/ViewModels/ProfileEditViewModel.cs b/clashN/clashN/ViewModels/ProfileEditViewModel.cs index 5519f87..b2ef467 100644 --- a/clashN/clashN/ViewModels/ProfileEditViewModel.cs +++ b/clashN/clashN/ViewModels/ProfileEditViewModel.cs @@ -61,6 +61,7 @@ namespace clashN.ViewModels SaveProfile(); }); + Utils.SetDarkBorder(view, _config.uiItem.colorModeDark); } private void SaveProfile() diff --git a/clashN/clashN/Views/GlobalHotkeySettingWindow.xaml.cs b/clashN/clashN/Views/GlobalHotkeySettingWindow.xaml.cs index 45c33a0..eecb7ab 100644 --- a/clashN/clashN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/clashN/clashN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -52,6 +52,8 @@ namespace clashN.Views txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown; BindingData(-1); + + Utils.SetDarkBorder(this, _config.uiItem.colorModeDark); }