Merge pull request #213 from FrzMtrsprt/main

Fix window border color and size
This commit is contained in:
2dust
2023-01-05 19:35:05 +08:00
committed by GitHub
3 changed files with 15 additions and 9 deletions

View File

@@ -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()
{

View File

@@ -61,6 +61,7 @@ namespace clashN.ViewModels
SaveProfile();
});
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
}
private void SaveProfile()

View File

@@ -52,6 +52,8 @@ namespace clashN.Views
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown;
BindingData(-1);
Utils.SetDarkBorder(this, _config.uiItem.colorModeDark);
}