コード例 #1
0
 private void InitialCursors(ref FigCursors ft)
 {
     ft.width  = Width;
     ft.StepX  = StepX;
     ft.height = Height;
     ft.StartX = StartX;
     ft.StepY  = StepY;
     ft.EndX   = EndX;
     ft.StartY = StartY;
     ft.EndY   = EndY;
 }
コード例 #2
0
        private void LongSrtipToolLayout_MouseUp(object sender, MouseEventArgs e)
        {
            ///重置缩放区域
            if (zoomRegion != null &&
                zoomRegion.width != 0 &&
                zoomRegion.height != 0 &&
                !MouseIsDoubleClick)
            {
                FigCursors ft = new FigCursors();
                InitialFigCursors(ref ft);
                ft.XPixel = zoomRegion.minX;
                ft.YPixel = zoomRegion.minY;
                float sx = ft.X;
                float ey = ft.Y;
                int   xa = ft.XPixel;
                int   ya = ft.YPixel;

                ft.XPixel = zoomRegion.minX + zoomRegion.width - 1;
                ft.YPixel = zoomRegion.minY + zoomRegion.height - 1;
                float ex = ft.X;
                float sy = ft.Y;
                int   xb = ft.XPixel;
                int   yb = ft.YPixel;

                /*Console.WriteLine(new Rectangle(xa, ya, xb - xa, yb - ya));
                 * Console.WriteLine("sx=" + sx.ToString());
                 * Console.WriteLine("ex=" + ex.ToString());
                 * Console.WriteLine("sy=" + sy.ToString());
                 * Console.WriteLine("ey=" + ey.ToString());*/

                if (xb > xa & yb > ya)
                {
                    StartX = sx;
                    EndX   = ex;
                    StartY = sy;
                    EndY   = ey;
                    RangeChanged?.Invoke(new float[] {
                        StartX, EndX, StartY, EndY,
                        zoomRegion.minX, zoomRegion.minY, zoomRegion.width, zoomRegion.height
                    });
                }
            }
            zoomRegion = null;


            Invalidate();

            ///重置光标选定信息和状态信息
            MouseLeftIsDown = false;

            MouseState = "+";
        }
コード例 #3
0
        private void InitialCursors()
        {
            Font   font   = new Font("宋体", 8);
            string format = "{0:0.00}";

            ReferenceC            = new FigCursors();
            ReferenceC.color      = Color.Red;
            ReferenceC.InfoFormat = format;
            ReferenceC.InfoFont   = font;
            ReferenceC.Name       = "Ref";

            MeasureC            = new FigCursors();
            MeasureC.color      = Color.Blue;
            MeasureC.InfoFormat = format;
            MeasureC.InfoFont   = font;
            MeasureC.Name       = "Mea";
        }
コード例 #4
0
        private void StateCursor(FigCursors csor, Point p)
        {
            string tmp;

            tmp        = csor.MouseState(p);
            MouseState = csor.Name + tmp;
            if (tmp == "X")
            {
                Cursor = Cursors.VSplit;
            }
            if (tmp == "Y")
            {
                Cursor = Cursors.HSplit;
            }
            if (tmp == null)
            {
                MouseState = "+";
            }
        }
コード例 #5
0
        private void AscanToolLayout_MouseUp(object sender, MouseEventArgs e)
        {
            ///重置缩放区域
            if (zoomRegion != null &&
                zoomRegion.width != 0 &&
                zoomRegion.height != 0 &&
                !MouseIsDoubleClick)
            {
                FigCursors ft = new FigCursors();
                InitialCursors(ref ft);

                ft.XPixel = zoomRegion.minX;
                ft.YPixel = zoomRegion.minY;
                float sx = ft.X;
                float ey = ft.Y;
                int   xa = ft.XPixel;
                int   ya = ft.YPixel;

                ft.XPixel = zoomRegion.minX + zoomRegion.width - 1;
                ft.YPixel = zoomRegion.minY + zoomRegion.height - 1;
                float ex = ft.X;
                float sy = ft.Y;
                int   xb = ft.XPixel;
                int   yb = ft.YPixel;

                /*Console.WriteLine(new Rectangle(xa, ya, xb - xa, yb - ya));
                 * Console.WriteLine("sx=" + sx.ToString());
                 * Console.WriteLine("ex=" + ex.ToString());
                 * Console.WriteLine("sy=" + sy.ToString());
                 * Console.WriteLine("ey=" + ey.ToString());*/

                if (xb > xa & yb > ya)
                {
                    StartX = sx;
                    EndX   = ex;
                    StartY = sy;
                    EndY   = ey;
                    RangeChanged?.Invoke(new float[] {
                        StartX, EndX, StartY, EndY,
                        zoomRegion.minX, zoomRegion.minY, zoomRegion.width, zoomRegion.height
                    });
                }
            }
            zoomRegion = null;

            ///1 鼠标双击时,设置光标,并获取当前光标相对位置
            ///2 重置双击状态
            if (MouseIsDoubleClick)
            {
                if (e.Button == MouseButtons.Left)
                {
                    EnableCursors(ref ReferenceC, e.X, e.Y);
                }
                else
                {
                    EnableCursors(ref MeasureC, e.X, e.Y);
                }
                MouseIsDoubleClick = false;
            }
            Invalidate();

            ///重置光标选定信息和状态信息
            MouseLeftIsDown = false;
            SetAllDisable();
            MouseState = "+";
        }
コード例 #6
0
 public void EnableCursors(ref FigCursors fc, int X, int Y)
 {
     fc.Enable = true;
     fc.XPixel = X;
     fc.YPixel = Y;
 }