예제 #1
0
파일: EditText.cs 프로젝트: AnuoF/MapFrame
        /// <summary>
        /// 鼠标双击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mapControl_OnDoubleClick(object sender, IMapControlEvents2_OnDoubleClickEvent e)
        {
            if (e.button != 1)
            {
                return;
            }
            isMove = false;
            IPoint point = new PointClass();

            point.PutCoords(e.mapX, e.mapY);
            var elementenum = graphicsContainer.LocateElements(point, 0);

            if (elementenum != null)
            {
                isLeftBtnDown           = true;
                mapControl.CurrentTool  = null;
                mapControl.MousePointer = esriControlsMousePointer.esriPointerCrosshair;
                textCtr = new MapFrame.ArcMap.Windows.TextInput();
                textCtr.SetText(editElement.Text);
                textCtr.SetFont(new System.Drawing.Font(editElement.FontName, (float)editElement.Size));

                //将arc的颜色转换为.net颜色
                System.Drawing.Color color = System.Drawing.ColorTranslator.FromOle(editElement.Color.RGB);
                textCtr.SetColor(color);
                textCtr.Location = new System.Drawing.Point(e.x, e.y);
                mapControl.CreateControl();
                mapControl.Controls.Add(textCtr);
                textCtr.InputFinished += InEditFinshen;
            }
        }
예제 #2
0
        /// <summary>
        /// 鼠标弹起结束绘制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void mapControl_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
        {
            IPoint point = new PointClass()
            {
                X = e.mapX, Y = e.mapY
            };

            envelope = rectangleFeedback.Stop() as IEnvelope;

            int layerCount = mapControl.LayerCount;

            for (int i = 0; i < layerCount; i++)
            {
                ILayer layer = mapControl.get_Layer(i);
                CompositeGraphicsLayerClass comp = layer as CompositeGraphicsLayerClass;
                if (comp == null)
                {
                    continue;
                }
                if (envelope.IsEmpty == true)
                {
                    elementEnums = comp.LocateElements(point, 0);
                }
                else
                {
                    elementEnums = comp.LocateElementsByEnvelope(envelope);
                }
                List <IElement> list = new List <IElement>();
                if (elementEnums == null)
                {
                    return;
                }
                IElement el = null;

                do
                {
                    el = elementEnums.Next();
                    if (el != null)
                    {
                        var element = el as IMFElement;
                        listElements.Add(element);
                    }
                }while (el != null);
            }
            ReleaseCommond();
        }