Пример #1
0
        //右键菜单点击事件
        private void toolManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {
            string strItemName = e.Tool.SharedProps.Caption.ToString();

            switch (strItemName)
            {
            case "键回退(&U)":
                Undo();

                break;

            case "输入左折角(&N)...":

                break;

            case "长度+方位角(&F)..":
                frmLengthAzim.m_pPoint = m_pLastPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                break;

            case "输入方位角(&O)...":
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                break;

            case "输入长度(&D)...":
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                break;

            case "矩形边长(&B)...":
                frmFixSideLength fromFixSideLength = new frmFixSideLength();
                fromFixSideLength.ShowDialog();

                break;

            case "绝对坐标(&A)...":
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                break;

            case "相对坐标(&R)...":
                frmRelaXYZ.m_pPoint = m_pLastPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)                       //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                break;

            case "平行(&P)...":
                m_pSegment  = null;
                m_bKeyCodeP = true;
                CommonFunction.ParallelRule(ref m_bKeyCodeP, m_pActiveView, m_dblTolerance, ref m_pSegment, m_pLastPoint, m_BeginConstructParallelPoint, ref m_pAnchorPoint);

                break;

            case "直角(&S)...":

                break;

            case "封闭完成(&C)":

                break;

            case "完成(&E)":
                EndDrawRectRelative2P();

                break;

            case "取消(ESC)":
                Reset();

                break;

            default:

                break;
            }
        }
Пример #2
0
        public override void OnKeyDown(int keyCode, int shift)
        {
            // TODO:  添加 DrawRectRelative2P.OnKeyDown 实现
            base.OnKeyDown(keyCode, shift);

            if (keyCode == 85 && m_mouseDownCount == 1)          //按U键,回退
            {
                Undo();

                return;
            }

            if (keyCode == 70 && m_mouseDownCount == 1)          //按F键,输入长度+方位角
            {
                frmLengthAzim.m_pPoint = m_pLastPoint;
                frmLengthAzim fromLengthDirect = new frmLengthAzim();
                fromLengthDirect.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 68 && m_mouseDownCount == 1)          //按D键,输入固定长度
            {
                frmFixLength fromFixLength = new frmFixLength();
                fromFixLength.ShowDialog();

                return;
            }

            if (keyCode == 79 && m_mouseDownCount == 1)          //按(O)orientation键,输入方向
            {
                frmFixAzim fromFixAzim = new frmFixAzim();
                fromFixAzim.ShowDialog();

                return;
            }

            if (keyCode == 66 && m_mouseDownCount == 2)          //按B键,输入边长
            {
                frmFixSideLength fromFixSideLength = new frmFixSideLength();
                fromFixSideLength.ShowDialog();

                return;
            }

            if (keyCode == 65 && m_mouseDownCount == 1)          //按A键,输入绝对坐标
            {
                frmAbsXYZ.m_pPoint = m_pAnchorPoint;
                frmAbsXYZ formXYZ = new frmAbsXYZ();
                formXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 82 && m_mouseDownCount == 1)          //按R键,输入相对坐标
            {
                frmRelaXYZ.m_pPoint = m_pLastPoint;
                frmRelaXYZ formRelaXYZ = new frmRelaXYZ();
                formRelaXYZ.ShowDialog();
                if (m_bInputWindowCancel == false)               //若用户没用取消输入
                {
                    DrawRectRelative2PMouseDown(m_pAnchorPoint);
                }

                return;
            }

            if (keyCode == 80 && m_mouseDownCount == 1)          //按P键,平行尺
            {
                m_pSegment  = null;
                m_bKeyCodeP = true;

                return;
            }

            if ((keyCode == 69 || keyCode == 13 || keyCode == 32) && m_mouseDownCount == 2)           //按E键、ENTER 键、SPACEBAR 键结束绘制
            {
                EndDrawRectRelative2P();

                return;
            }

            if (keyCode == 27)             //ESC 键,取消所有操作
            {
                Reset();

                this.Stop();
                WSGRI.DigitalFactory.Commands.ICommand command = DFApplication.Application.GetCommand("WSGRI.DigitalFactory.DF2DControl.cmdPan");
                if (command != null)
                {
                    command.Execute();
                }

                return;
            }
        }