-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMainWindow.xaml.cs
83 lines (69 loc) · 2.83 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System.Linq;
using System.Windows;
using System.Windows.Input;
using WpfScreenHelper.Enum;
namespace WpfScreenHelper.DpiTestWpfApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
{
foreach (var screen in Screen.AllScreens)
{
Monitors.Items.Add(screen.DeviceName);
}
Monitors.SelectedIndex = 0;
}
private void ButtonMaximize_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.Maximize, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonCenter_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.Center, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonLeft_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.Left, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonRight_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.Right, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonTop_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.Top, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonBottom_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.Bottom, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonTopLeft_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.TopLeft, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonTopRight_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.TopRight, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonBottomRight_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.BottomRight, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void ButtonBottomLeft_OnClick(object sender, RoutedEventArgs e)
{
this.SetWindowPosition(WindowPositions.BottomLeft, Screen.AllScreens.ElementAt(Monitors.SelectedIndex));
}
private void MainWindow_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
}
}