Exemple #1
0
        private void DrawExtent(IEnvelope envelope)
        {
            (axMapControl_hawkeye.Map as IGraphicsContainer).DeleteAllElements();
            IElement pElement = new RectangleElementClass()
            {
                Geometry = envelope,
                Symbol   = new SimpleFillSymbolClass()
                {
                    Color   = AeUtils.GetRgbColor(0, 0, 0, 0),
                    Outline = new SimpleLineSymbolClass()
                    {
                        Color = AeUtils.GetRgbColor(255, 0, 0),
                        Width = 2
                    }
                }
            };

            (axMapControl_hawkeye.Map as IGraphicsContainer).AddElement(pElement, 0);
            axMapControl_hawkeye.Refresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
Exemple #2
0
 void axMapControl_main_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
 {
     #region // 地图平移(漫游)
     if (e.button == 4)
     {
         m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerPanning;
         m_pMapC2.Pan();
         m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerArrow;
         return;
     }
     #endregion
     #region // 要素选择 2
     if (e.button == 1 && ckbx_select.Checked)
     {
         m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerCrosshair;
         IGeometry pGeometry = cbbx_select.SelectedIndex == 0 ? m_pMapC2.TrackRectangle() : m_pMapC2.TrackPolygon();
         (m_pMapC2.Map as IGraphicsContainer).DeleteAllElements();
         (m_pMapC2.Map as IGraphicsContainer).AddElement(new RectangleElementClass()
         {
             Geometry = pGeometry,
             Symbol   = new SimpleFillSymbolClass()
             {
                 Color   = AeUtils.GetRgbColor(0, 0, 0, 0),
                 Outline = new SimpleLineSymbolClass()
                 {
                     Color = AeUtils.GetRgbColor(255, 0, 0), Width = 1
                 }
             }
         }, 0);
         m_pMapC2.Refresh(esriViewDrawPhase.esriViewGraphics, null, null);
         m_pMapC2.Map.SelectByShape(pGeometry, null, false);
         m_pMapC2.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
         m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerArrow;
         return;
     }
     #endregion
 }