diff --git a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs index 5fd56159..4fd1be1a 100644 --- a/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServer2Window.xaml.cs @@ -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); diff --git a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs index f16310e2..e83554a9 100644 --- a/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/AddServerWindow.xaml.cs @@ -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(); } } -} \ No newline at end of file +} diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index d95bc136..8b84f2a3 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -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(); diff --git a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs index 15221b1d..5b357f69 100644 --- a/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/GlobalHotkeySettingWindow.xaml.cs @@ -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(); diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index ba961f66..1e731078 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -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}" diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index d98ab2d5..9ff4bea0 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -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; diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index 7d44263e..80f86efe 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -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(); diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index 45d16c69..bd383aeb 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -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; diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs index cfdb4432..a1fc44f6 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml.cs @@ -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; diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs index 0f001dc9..e1509d98 100644 --- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs @@ -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; diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs index 00187ce1..521309d8 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml.cs @@ -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; diff --git a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs index 7f4eee58..3ebf9e51 100644 --- a/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/SubSettingWindow.xaml.cs @@ -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);