Ejemplo n.º 1
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_logoPath = GetLogoPath();
            IMap        map        = m_hookHelper.FocusMap;
            IDynamicMap dynamicMap = map as IDynamicMap;

            IActiveView activeView = map as IActiveView;

            /*IActiveViewEvents_Event */ avEvents = activeView as IActiveViewEvents_Event;
            IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as IDynamicMapEvents_Event;
            IScreenDisplay          screenDisplay    = activeView.ScreenDisplay;

            if (!m_bIsOn)
            {
                avEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
                dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
            }
            else
            {
                dynamicMapEvents.AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
                avEvents.AfterDraw -= new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
            }
            m_bIsOn = !m_bIsOn;
            screenDisplay.Invalidate(null, true, (short)esriScreenCache.esriNoScreenCache);
            screenDisplay.UpdateWindow();
        }
Ejemplo n.º 2
0
 public static void DrawText(IScreenDisplay paramScreenDisplay, IGeometry paramGeom, string paramText,
                             ISymbol paramSymbol)
 {
     if ((paramScreenDisplay == null || paramGeom == null || paramGeom.IsEmpty || paramSymbol == null
         ? false
         : paramSymbol is ITextSymbol))
     {
         paramScreenDisplay.StartDrawing(paramScreenDisplay.hDC, -2);
         paramScreenDisplay.UpdateWindow();
         paramScreenDisplay.SetSymbol(paramSymbol);
         if (paramText == null)
         {
             paramText = "";
         }
         paramScreenDisplay.DrawText(paramGeom, paramText);
         paramScreenDisplay.FinishDrawing();
     }
 }
Ejemplo n.º 3
0
        ///<summary>Flash geometry on the display.</summary>
        ///<param name="geometry"> The input IGeometry to flash.  Supported geometry types are GeometryBag, Polygon, Polyline, Point and Multipoint.</param>
        ///<param name="screenDisplay">An IScreenDisplay reference</param>
        ///<param name="delay">An integer that is the time in milliseconds to wait.</param>
        public static void FlashGeometry(IGeometry geometry, IScreenDisplay screenDisplay, int delay, int times)
        {
            if (geometry == null || screenDisplay == null)
            {
                return;
            }
            bool continueFlashing = true;

            using (ComReleaser comReleaser = new ComReleaser())
            {
                ITrackCancel cancelTracker = new CancelTrackerClass();
                comReleaser.ManageLifetime(cancelTracker);
                screenDisplay.CancelTracker = cancelTracker;
                short cacheID = screenDisplay.AddCache();
                int cacheMemDC = screenDisplay.get_CacheMemDC(cacheID);
                
                IRgbColor fillColor = new RgbColorClass();
                comReleaser.ManageLifetime(fillColor);
                fillColor.Green = 128;
                IRgbColor lineColor = new RgbColorClass();
                comReleaser.ManageLifetime(lineColor);

                screenDisplay.StartDrawing(cacheMemDC, cacheID);
                DrawGeometry(geometry, fillColor, lineColor, (IDisplay)screenDisplay, cancelTracker);
                ESRI.ArcGIS.esriSystem.tagRECT RECT = new tagRECT();
                screenDisplay.FinishDrawing();

                for (int j = 0; j < times; j++)
                {
                    if (continueFlashing == true)
                    {
                        screenDisplay.DrawCache(screenDisplay.hDC, cacheID, ref RECT, ref RECT);
                        if (delay > 0)
                        {
                            System.Threading.Thread.Sleep(delay);
                            screenDisplay.Invalidate(null, true, cacheID);
                            screenDisplay.UpdateWindow();
                            System.Threading.Thread.Sleep(delay);
                        }
                    }
                }
                //---------------------------------------------------------------------

                screenDisplay.RemoveCache(cacheID);
                cancelTracker.Reset();
            }
        }