Exemplo n.º 1
0
        private void imageContainer_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            try
            {
                //get the transformer form the image transform group
                ScaleTransform transform = imageTransformGroup.Children[0] as ScaleTransform;

                if (e.Delta > 0)
                {
                    browser.ZoomIn(1.3, transform);
                }
                else
                {
                    browser.ZoomOut(1.3, transform);
                }
                //change the cursor according zoom in and out
                if (transform.ScaleX >= 1.3)
                {
                    imageContainer.Cursor = Cursors.Hand;
                }
                else
                {
                    imageContainer.Cursor = Cursors.Arrow;
                }
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Fail to get the scale transformer");
                System.Environment.Exit(1);
            }
        }