File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,14 @@ Public Class SettingsHandler : Inherits ObservableObject
6464 AppSettings.WindowWidth = 500
6565 End If
6666
67+ Dim scHeight = SystemParameters.MaximizedPrimaryScreenHeight * 0.9
68+
69+ If scHeight < AppSettings.WindowHeight Then
70+ AppSettings.WindowHeight = scHeight
71+ AppSettings.WindowWidth = scHeight * 0.625
72+ AppSettings.WindowScalingFactor = scHeight / 800
73+ End If
74+
6775 End Sub
6876
6977
Original file line number Diff line number Diff line change 99 mc : Ignorable =" d" xmlns : ui =" http://schemas.modernwpf.com/2019" xmlns : scm =" clr-namespace:System.ComponentModel;assembly=WindowsBase" d : DataContext =" {d:DesignInstance Type=local:MainViewModel}" RenderOptions.ClearTypeHint=" Enabled"
1010 WindowState =" {Binding WindowState}" ShowInTaskbar =" {Binding ShowInTaskbar}" AllowDrop =" True" Drop =" Window_Drop"
1111 ui:WindowHelper.UseModernWindowStyle=" True" ui:TitleBar.ExtendViewIntoTitleBar=" True"
12- Title =" CompactGUI"
12+ Title =" CompactGUI" Loaded = " MainWindow_Loaded "
1313 Height =" {Binding BindableSettings.WindowHeight, Mode=TwoWay,FallbackValue=800}"
1414 Width =" {Binding BindableSettings.WindowWidth, Mode=TwoWay, FallbackValue=500}" ResizeMode =" NoResize"
1515 WindowStyle =" SingleBorderWindow" Background =" White" >
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ Class MainWindow
1313 Me .DataContext = ViewModel
1414
1515 ViewModel.State = "FreshLaunch"
16+
17+
1618 End Sub
1719
1820 Public Property ViewModel As New MainViewModel
@@ -58,4 +60,13 @@ Class MainWindow
5860
5961
6062 End Sub
63+
64+ Private Sub MainWindow_Loaded(sender As Object , e As RoutedEventArgs)
65+
66+ Me .Top = (SystemParameters.PrimaryScreenHeight - SettingsHandler.AppSettings.WindowHeight) / 2
67+ Me .Left = (SystemParameters.PrimaryScreenWidth - SettingsHandler.AppSettings.WindowWidth) / 2
68+
69+ If Me .Top < 0 Then Me .Top = 0
70+
71+ End Sub
6172End Class
You can’t perform that action at this time.
0 commit comments