Merge pull request #213 from FrzMtrsprt/main
Fix window border color and size
This commit is contained in:
@@ -14,6 +14,7 @@ using System.Reactive;
|
|||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Interop;
|
||||||
using Application = System.Windows.Application;
|
using Application = System.Windows.Application;
|
||||||
|
|
||||||
namespace clashN.ViewModels
|
namespace clashN.ViewModels
|
||||||
@@ -472,18 +473,20 @@ namespace clashN.ViewModels
|
|||||||
|
|
||||||
if (_config.uiItem.mainWidth > 0 && _config.uiItem.mainHeight > 0)
|
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.Width = _config.uiItem.mainWidth;
|
||||||
Application.Current.MainWindow.Height = _config.uiItem.mainHeight;
|
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()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace clashN.ViewModels
|
|||||||
SaveProfile();
|
SaveProfile();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveProfile()
|
private void SaveProfile()
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ namespace clashN.Views
|
|||||||
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown;
|
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown;
|
||||||
|
|
||||||
BindingData(-1);
|
BindingData(-1);
|
||||||
|
|
||||||
|
Utils.SetDarkBorder(this, _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user