using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MouseEvents
{
    
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void MouseWheel_EventHandler(object sender, MouseWheelEventArgs e)
        {
            Window window = e.Source as Window;

            if (window != null)
            {
                window.Width = (window.Width + e.Delta > 100 ? window.Width + e.Delta : 100);
                window.Height = (window.Height + e.Delta > 100 ? window.Height + e.Delta : 100);
            }

        }

        private void MouseDown_EventHandler(object sender, MouseButtonEventArgs e)
        {
            Window window = e.Source as Window;
            if (window != null)
            {
                switch (e.ChangedButton)
                {
                    case MouseButton.XButton1:
                        window.Background = Brushes.Aqua;
                        break;
                    case MouseButton.XButton2:
                        window.Background = Brushes.Brown;
                        break;
                    case MouseButton.Right:
                        window.Background = Brushes.Violet;
                        break;
                    case MouseButton.Middle:
                        window.Background = Brushes.LightGreen;
                        break;
                    case MouseButton.Left:
                        window.Background = Brushes.Red;
                        break;
                    default:
                        break;
                }
            }
        }

       
    }
}
