private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
// выясняем текущий размер рабочей области
Rect workArea = SystemParameters.WorkArea; // получаем ссылку на окно
Window window = sender as Window;
// позиционируем окно взависимости от пользовательского ввода
switch (e.Key)
{
case Key.T:
{
Window.Left = 0;
Window.Top = 0;
Window.Width = workArea.Width;
Window.Height = workArea.Height / 2;
break;
}
case Key.B:
{
Window.Width = workArea.Width;
Window.Height = workArea.Height / 2;
Window.Left = 0;
Window.Top = workArea.Height - window.Height;
break;
}
case Key.L:
{
Window.Left = 0;
Window.Top = 0;
Window.Width = workArea.Width / 2;
Window.Height = workArea.Height;
break;
}
case Key.R:
{
Window.Width = workArea.Width / 2;
Window.Height = workArea.Height;
Window.Left = workArea.Width - window.Width;
Window.Top = 0;
break;
}
}
}