예제 #1
0
        /// <summary>
        /// 恾宍偺庢摼 (埵抲巜掕)
        /// </summary>
        /// <param name="location">巜掕埵抲 (僋儔僀傾儞僩嵗昗)</param>
        /// <returns>
        ///		巜掕埵抲偵偁傞恾宍傪曉偟傑偡丅
        ///		尒偮偐傟側偗傟偽 null 傪曉偟傑偡丅
        /// </returns>
        public virtual FVIL.GDI.CFviGdiFigure GetFigure(Point location)
        {
            // View僋儔僀傾儞僩椞堟忋偱偺嵗昗.
            // Scaling = true 偺帪偼丄夋憸嵗昗偵曄姺.
            FVIL.Data.CFviPoint position = (Scaling)
                ? DPtoIP(location, ScalingMode)
                : new FVIL.Data.CFviPoint(location);

            // 攝楍偺枛旜(倅曽岦偺慜柺)偐傜張棟偡傞.
            for (int i = Figures.Count - 1; i >= 0; i--)
            {
                FVIL.GDI.CFviGdiFigure figure = Figures[i];
                int iGripPosition             = figure.CheckFocusMarkPosition(position, 8 / Magnification);
                if (iGripPosition != 0)
                {
                    return(figure);
                }
            }
            return(null);
        }
예제 #2
0
        /// <summary>
        /// 儅僂僗僇乕僜儖偺宍忬曄峏壜斲敾掕
        /// </summary>
        /// <param name="sender">儅僂僗僀儀儞僩偑敪惗偟偨僐儞僩儘乕儖</param>
        /// <param name="e">敪惗偟偨儅僂僗僀儀儞僩</param>
        /// <param name="AllowChange">僇乕僜儖曄峏嫋壜僗僥乕僞僗</param>
        public override void CanChangeCursor(System.Object sender, System.Windows.Forms.MouseEventArgs e, ref bool AllowChange)
        {
            if (!Active)
            {
                return;             // 姳徛偟側偄.
            }
            try {
                System.Windows.Forms.Cursor cursor = System.Windows.Forms.Cursors.Default;

                // sender 傑偨偼 e 偑柍岠側応崌偼柍帇偡傞.
                if (ReferenceEquals(sender, null))
                {
                    return;
                }
                if (ReferenceEquals(e, null))
                {
                    return;
                }

                System.Windows.Forms.Control control = (System.Windows.Forms.Control)sender;

                //
                // 張棟懳徾偺恾宍.
                //
                bool selected = false;
                bool redraw   = false;

                // View僋儔僀傾儞僩椞堟忋偱偺嵗昗.
                // Scaling = true 偺帪偼丄夋憸嵗昗偵曄姺.
                FVIL.Data.CFviPoint position = (Scaling)
                    ? DPtoIP(e.Location, ScalingMode)
                    : new FVIL.Data.CFviPoint(e.Location);

                // 攝楍偺枛旜(倅曽岦偺慜柺)偐傜張棟偡傞.
                for (int i = Figures.Count - 1; i >= 0; i--)
                {
                    FVIL.GDI.CFviGdiFigure figure = Figures[i];
                    if (m_MouseInfo.bGrip == true)
                    {
                        if (ReferenceEquals(figure, m_MouseInfo.figure))
                        {
                            if (figure.Select != true)
                            {
                                redraw = true;
                            }
                            figure.Select = true;
                            selected      = true;
                        }
                    }
                    else if (figure.Enable)
                    {
                        int iGripPosition = figure.CheckFocusMarkPosition(position, 8 / Magnification);
                        if (iGripPosition != 0 && selected == false)
                        {
                            if (figure.Select != true)
                            {
                                redraw = true;
                            }
                            figure.Select = true;
                            selected      = true;
                        }
                        else
                        {
                            if (figure.Select != false)
                            {
                                redraw = true;
                            }
                            figure.Select = false;
                        }
                    }
                }

                if (redraw)
                {
                    ((System.Windows.Forms.Control)sender).Refresh();
                }

                cursor = System.Windows.Forms.Cursors.SizeAll;

                // (!) 僇乕僜儖宍忬偺曄峏張棟
                //     AllowChange 偼丄懠偺僆乕僶儗僀偺僇乕僜儖曄峏張棟偲姳徛偟側偄傛偆偵偡傞堊偺僼儔僌偱偡.
                //     婛偵 AllowChange 偑 false 偺帪偼丄偙偺僆乕僶儗僀偱偺僇乕僜儖曄峏張棟傪峴偄傑偣傫丅
                //     AllowChange 偑 true 偺帪丄僇乕僜儖宍忬偺曄峏張棟傪峴偄傑偡丅
                //     僇乕僜儖曄峏屻丄AllowChange 傪 false 偵曄峏偟傑偡丅

                // 僇乕僜儖曄峏.
                if (AllowChange && selected == true)
                {
                    control.Cursor = cursor;
                    AllowChange    = false; // 曄峏傪嫋壜偟側偄.
                }
            }
            catch (System.Exception) {
            }
            return;
        }
예제 #3
0
        /// <summary>
        /// 儅僂僗僌儕僢僾壜斲敾掕
        /// </summary>
        /// <param name="sender">儅僂僗僀儀儞僩偑敪惗偟偨僐儞僩儘乕儖</param>
        /// <param name="e">敪惗偟偨儅僂僗僀儀儞僩</param>
        /// <param name="AllowGrip">僌儕僢僾嫋壜僗僥乕僞僗</param>
        public override void CanMouseGrip(System.Object sender, System.Windows.Forms.MouseEventArgs e, ref bool AllowGrip)
        {
            if (!Active)
            {
                return;             // 姳徛偟側偄.
            }
            if (AllowGrip)
            {
                try {
                    FVIL.Data.CFviPoint position = (Scaling)
                        ? DPtoIP(e.Location, ScalingMode)
                        : new FVIL.Data.CFviPoint(e.Location);

                    // 攝楍偺枛旜(倅曽岦偺慜柺)偐傜張棟偡傞.
                    for (int i = Figures.Count - 1; i >= 0; i--)
                    {
                        FVIL.GDI.CFviGdiFigure figure = Figures[i];
                        if (m_MouseInfo.bGrip == true)
                        {
                            if (ReferenceEquals(figure, m_MouseInfo.figure))
                            {
                                // 懠偺僆乕僶儗僀偱偺僌儕僢僾傪嫋壜偟側偄.
                                AllowGrip = false;
                                break;
                            }
                        }
                        else if (figure.Enable)
                        {
                            int iGripPosition = figure.CheckFocusMarkPosition(position, 8 / Magnification);
                            if (iGripPosition != 0)
                            {
                                if (figure is FVIL.GDI.CFviGdiPolyline)
                                {
                                    // (!) 懡妏宍偵懳偡傞巄掕揑側張抲.
                                    // CFviGdiPolyline 偑 Close 偺偲偒傕捀揰偱斀墳偝偣傞張抲.
                                    // 僗儗僢僪僙乕僼偱偼側偄偺偱拲堄.
                                    // 杮棃偼丄宲彸偟偰 CheckFocusMarkPosition 傪僆乕僶乕儔僀僪偡傞傋偒.

                                    FVIL.GDI.CFviGdiPolyline _figure = (FVIL.GDI.CFviGdiPolyline)figure;
                                    if (_figure.Close)
                                    {
                                        _figure.Close = false;
                                        int iGripVetex = _figure.CheckFocusMarkPosition(position, 8 / Magnification);
                                        _figure.Close = true;
                                        // 捀揰傑偨偼曈埲奜偱奜愙嬮宍撪偺偲偒偼堏摦(-1)偲偡傞.
                                        iGripPosition = (iGripVetex != 0) ? iGripVetex : -1;
                                    }
                                }

                                // View僋儔僀傾儞僩椞堟忋偱偺嵗昗.
                                // Scaling = true 偺帪偼丄夋憸嵗昗偵曄姺.
                                FVIL.Data.CFviPoint mouse = (Scaling)
                                    ? DPtoIP(e.Location, ScalingMode)
                                    : new FVIL.Data.CFviPoint(e.Location);

                                // 僌儕僢僾埵抲偲恾宍偺忬懺傪曐帩偡傞.
                                m_MouseInfo.bGrip         = true;
                                m_MouseInfo.iGripPosition = iGripPosition;
                                m_MouseInfo.mouse         = mouse;
                                m_MouseInfo.figure        = figure;
                                m_MouseInfo.position      = figure.Position;
                                m_MouseInfo.axis          = figure.Axis;
                                m_MouseInfo.angle         = figure.Angle;
                                m_MouseInfo.clip          = figure.GetClipRect();
                                Validate(ref m_MouseInfo);      // 桳岠壔.

                                // 懠偺僆乕僶儗僀偱偺僌儕僢僾傪嫋壜偟側偄.
                                AllowGrip = false;
                                break;
                            }
                        }
                    }
                }
                catch (System.Exception) {
                }
            }
            return;
        }