ZoomAndPanSample.OverviewWindow.Window_MouseDown C# (CSharp) Method

Window_MouseDown() private method

Event raised on mouse down.
private Window_MouseDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void
sender object
e System.Windows.Input.MouseButtonEventArgs
return void
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //
            // Update the position of the overview rect to the point that was clicked.
            //
            Point clickedPoint = e.GetPosition(content);
            double newX = clickedPoint.X - (overviewZoomRectThumb.Width / 2);
            double newY = clickedPoint.Y - (overviewZoomRectThumb.Height / 2);
            Canvas.SetLeft(overviewZoomRectThumb, newX);
            Canvas.SetTop(overviewZoomRectThumb, newY);
        }