Merge pull request #4048 from crazypeace/master

解决窗口尺寸大于屏幕尺寸的问题 #
pull/4122/head
2dust 2023-07-10 15:26:20 +08:00 committed by GitHub
commit 6fd2499daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 122 additions and 3 deletions

View File

@ -11,6 +11,17 @@ namespace v2rayN.Views
public AddServer2Window(ProfileItem profileItem)
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
this.Loaded += Window_Loaded;
ViewModel = new AddServer2ViewModel(profileItem, this);

View File

@ -15,6 +15,17 @@ namespace v2rayN.Views
public AddServerWindow(ProfileItem profileItem)
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
this.Loaded += Window_Loaded;
cmbNetwork.SelectionChanged += CmbNetwork_SelectionChanged;
@ -295,4 +306,4 @@ namespace v2rayN.Views
this.Close();
}
}
}
}

View File

@ -14,6 +14,17 @@ namespace v2rayN.Views
public DNSSettingWindow()
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
_config = LazyConfig.Instance.GetConfig();

View File

@ -16,6 +16,17 @@ namespace v2rayN.Views
public GlobalHotkeySettingWindow()
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
_config = LazyConfig.Instance.GetConfig();
_config.globalHotkeys ??= new List<KeyEventItem>();

View File

@ -15,8 +15,6 @@
Title="v2rayN"
Width="900"
Height="700"
MinWidth="900"
MinHeight="700"
x:TypeArguments="vms:MainWindowViewModel"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"

View File

@ -25,6 +25,17 @@ namespace v2rayN.Views
public MainWindow()
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
_config = LazyConfig.Instance.GetConfig();
App.Current.SessionEnding += Current_SessionEnding;

View File

@ -18,6 +18,17 @@ namespace v2rayN.Views
public OptionSettingWindow()
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
_config = LazyConfig.Instance.GetConfig();

View File

@ -12,6 +12,17 @@ namespace v2rayN.Views
public RoutingRuleDetailsWindow(RulesItem rulesItem)
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
this.Loaded += Window_Loaded;
clbProtocol.SelectionChanged += ClbProtocol_SelectionChanged;

View File

@ -13,6 +13,17 @@ namespace v2rayN.Views
public RoutingRuleSettingWindow(RoutingItem routingItem)
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
this.Loaded += Window_Loaded;
this.PreviewKeyDown += RoutingRuleSettingWindow_PreviewKeyDown;

View File

@ -12,6 +12,17 @@ namespace v2rayN.Views
public RoutingSettingWindow()
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
this.Closing += RoutingSettingWindow_Closing;
this.PreviewKeyDown += RoutingSettingWindow_PreviewKeyDown;

View File

@ -11,6 +11,17 @@ namespace v2rayN.Views
public SubEditWindow(SubItem subItem)
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
this.Loaded += Window_Loaded;

View File

@ -13,6 +13,17 @@ namespace v2rayN.Views
public SubSettingWindow()
{
InitializeComponent();
// 设置窗口的尺寸不大于屏幕的尺寸
if (this.Width > SystemParameters.WorkArea.Width)
{
this.Width = SystemParameters.WorkArea.Width;
}
if (this.Height > SystemParameters.WorkArea.Height)
{
this.Height = SystemParameters.WorkArea.Height;
}
this.Owner = Application.Current.MainWindow;
ViewModel = new SubSettingViewModel(this);