diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-25 16:26:36 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-25 16:26:36 +0300 |
| commit | fa53cf658d60afbcfb0449eb525da5a847075aa9 (patch) | |
| tree | 31c96d3bab8a54ebbf04be6aab14371be45aa1bb /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs | |
| parent | 86197cd0ec87a6cc186e90f75d848adc6dfa2285 (diff) | |
| download | Tango-fa53cf658d60afbcfb0449eb525da5a847075aa9.tar.gz Tango-fa53cf658d60afbcfb0449eb525da5a847075aa9.zip | |
Working on logging module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs | 30 |
1 files changed, 30 insertions, 0 deletions
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<double> ratios = new List<double>() { 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) |
