private async void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            StartPosition = true;
            MarkStart     = false;
            Hide_window();
            await Task.Delay(50);//

            endV   = MouseHook.getEndValue();
            startV = MouseHook.getStartValue();
            this.Hide();
            _snippingTool = new SnippingTool();
            _snippingTool.snippingTool(startV, endV);
        }
 private void Window_MouseMove(object sender, MouseEventArgs e)
 {
     if (MarkStart == true)
     {
         if (StartPosition == true)
         {
             sourceX = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenLeft);
             sourceY = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenTop);
             this.MarkingSquare.Visibility = System.Windows.Visibility.Visible;
             startV = MouseHook.getStartValue();
             this.MarkingSquare.Margin = new Thickness(-sourceX + startV.x, -sourceY + startV.y, 0, 0);
         }
         StartPosition = false;
         Marking();
     }
 }
        public void Marking()
        {
            endV    = MouseHook.getMousePosition();
            startV  = MouseHook.getStartValue();
            sourceX = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenLeft);
            sourceY = Convert.ToInt32(System.Windows.SystemParameters.VirtualScreenTop);

            if (startV.x > endV.x && startV.y < endV.y)
            {
                this.MarkingSquare.Margin = new Thickness(-sourceX + endV.x, -sourceY + startV.y, 0, 0);
                this.MarkingSquare.Width  = startV.x - endV.x;
                this.MarkingSquare.Height = endV.y - startV.y;
                return;
            }
            else if (startV.x < endV.x && startV.y > endV.y)
            {
                this.MarkingSquare.Width  = endV.x - startV.x;
                this.MarkingSquare.Height = startV.y - endV.y;
                this.MarkingSquare.Margin = new Thickness(-sourceX + startV.x, -sourceY + endV.y, 0, 0);
                return;
            }
            else if (startV.x > endV.x && startV.y > endV.y)
            {
                this.MarkingSquare.Margin = new Thickness(-sourceX + endV.x, -sourceY + endV.y, 0, 0);
                this.MarkingSquare.Width  = startV.x - endV.x;
                this.MarkingSquare.Height = startV.y - endV.y;
                return;
            }
            else if (startV.x == endV.x || startV.y == endV.y)
            {
                this.MarkingSquare.Width = 0;
                return;
            }
            else
            {
                this.MarkingSquare.Width  = endV.x - startV.x;
                this.MarkingSquare.Height = endV.y - startV.y;
                return;
            }
        }