From fa53cf658d60afbcfb0449eb525da5a847075aa9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 25 Mar 2018 16:26:36 +0300 Subject: Working on logging module. --- .../Tango.MachineStudio.UI/MainWindow.xaml.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index c4d9b4a28..48de019e8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -48,6 +48,36 @@ namespace Tango.MachineStudio.UI } this.Loaded += MainWindow_Loaded; + this.SizeChanged += MainWindow_SizeChanged; + } + + private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e) + { + var screen = System.Windows.Forms.Screen.FromHandle(new WindowInteropHelper(this).Handle); + + double scr_width = screen.Bounds.Width; + double scr_height = screen.Bounds.Height; + + double ratio = scr_width / scr_height; + + List ratios = new List() { 16d / 9d, 16d / 10d, 4d / 3d }; + ratio = ratios.Closest(ratio); + + switch (ratio) + { + case 16d / 9d: + grid.Height = 1100; + break; + case 16d / 10d: + grid.Height = 1145; + break; + case 4d / 3d: + grid.Height = 1280; + break; + default: + grid.Height = 1145; + break; + } } private void MainWindow_Loaded(object sender, RoutedEventArgs e) -- cgit v1.3.1