Beispiel #1
0
        private void panel_MouseUp(object sender, MouseEventArgs e)
        {
            //------------MouseRight: Zoom out
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                myImage.ZoomInOut(1, myImage.MapToImageX(e.X), myImage.MapToImageY(e.Y));
                panel.Refresh();
            }
            //------------MouseLeft: Zoom in
            else if (e.Button == System.Windows.Forms.MouseButtons.Left && isZoom || checkFlagTSB3 == true)
            {
                ControlPaint.DrawReversibleFrame(theRectangle, RubberColor, FrameStyle.Thick);
                theRectangle = new Rectangle(0, 0, 0, 0);

                mx0 = picMX0;
                my0 = picMY0;
                mox = e.X;
                moy = e.Y;

                double xx0 = IIF(mx0 > mox, mox, mx0);
                double yy0 = IIF(my0 > moy, moy, my0);
                double xx1 = IIF(mx0 > mox, mx0, mox);
                double yy1 = IIF(my0 > moy, my0, moy);

                if (Math.Abs(xx1 - xx0) > 5.0 || Math.Abs(yy1 - yy0) > 5.0)
                {
                    myImage.xWinMin = myImage.MapToImageX(xx0);
                    myImage.yWinMin = myImage.MapToImageY(yy0);
                    myImage.xWinMax = myImage.MapToImageX(xx1);
                    myImage.yWinMax = myImage.MapToImageY(yy1);
                    panel.Refresh();
                }
                else
                {
                    myImage.ZoomInOut(0, myImage.MapToImageX(e.X), myImage.MapToImageY(e.Y));
                    panel.Refresh();
                }
                if (checkFlagTSB3 == false)
                {
                    panel.Cursor = Cursors.Default;
                }
            }
            else if (e.Button == MouseButtons.Middle && isMove)
            {
                if (checkFlagTSB4 == false)
                {
                    panel.Cursor = Cursors.Default;
                }
            }
            isZoom        = false;
            isMove        = false;
            isLeftClicked = false;
        }