当前位置: 首页>>代码示例>>C#>>正文


C# CancelTrackerClass.Reset方法代码示例

本文整理汇总了C#中CancelTrackerClass.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# CancelTrackerClass.Reset方法的具体用法?C# CancelTrackerClass.Reset怎么用?C# CancelTrackerClass.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CancelTrackerClass的用法示例。


在下文中一共展示了CancelTrackerClass.Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FlashGeometry

        ///<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();
            }
        }
开发者ID:HabitatFramework,项目名称:HLUTool,代码行数:51,代码来源:HluArcMapExtension.cs

示例2: ExportActiveView

        //输出当前地图至指定的文件
        public static void ExportActiveView(IActiveView pView, Size outRect, string outPath)
        {
            try
            {
                //参数检查
                if (pView == null)
                {
                    throw new Exception("输入参数错误,无法生成图片文件!");
                }

                //根据给定的文件扩展名,来决定生成不同类型的对象
                ESRI.ArcGIS.Output.IExport export = null;
                if (outPath.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportJPEGClass();
                }
                else if (outPath.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportTIFFClass();
                }
                else if (outPath.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportBMPClass();
                }
                else if (outPath.EndsWith(".emf", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportEMFClass();
                }
                else if (outPath.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportPNGClass();
                }
                else if (outPath.EndsWith(".gif", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportGIFClass();
                }

                SetOutputQuality(pView, 1);

                export.ExportFileName = outPath;
                IEnvelope pEnvelope = pView.Extent;
                //导出参数
                export.Resolution = 300;

                tagRECT exportRect = new tagRECT();
                exportRect.left = exportRect.top = 0;
                exportRect.right = outRect.Width;
                exportRect.bottom = (int)(exportRect.right * pEnvelope.Height / pEnvelope.Width);
                ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
                //输出范围
                envelope.PutCoords(exportRect.left, exportRect.top, exportRect.right, exportRect.bottom);
                export.PixelBounds = envelope;
                //可用于取消操作
                ITrackCancel pCancel = new CancelTrackerClass();
                export.TrackCancel = pCancel;
                pCancel.Reset();
                //点击ESC键时,中止转出
                pCancel.CancelOnKeyPress = true;
                pCancel.CancelOnClick = false;
                pCancel.ProcessMessages = true;
                //获取handle
                System.Int32 hDC = export.StartExporting();
                //开始转出
                pView.Output(hDC, (System.Int32)export.Resolution, ref exportRect, pEnvelope, pCancel);
                bool bContinue = pCancel.Continue();
                //捕获是否继续
                if (bContinue)
                {
                    export.FinishExporting();
                    export.Cleanup();
                }
                else
                {
                    export.Cleanup();
                }

                bContinue = pCancel.Continue();
            }
            catch (Exception e)
            {
                //错误信息提示
            }
        }
开发者ID:niwho,项目名称:ArcGISFundation,代码行数:84,代码来源:PrintHelper.cs


注:本文中的CancelTrackerClass.Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。