public void ResizeShowCharts() { tagRECT rect1 = new tagRECT(); tagRECT rect2 = new tagRECT(); tagRECT rect3 = new tagRECT(); tagRECT rect4 = new tagRECT(); MainWindowViewModel mainModel = Application.Current.MainWindow.DataContext as MainWindowViewModel; Window mainWnd = Application.Current.MainWindow; if (mainModel.bShowPage == PageVisibleEnum.PageVisibleEnum_SignStat) { double totalTitleHeight = mainModel.titleheight + topHeight; System.Windows.Point ptOriginalDlg = new System.Windows.Point(0, 0); System.Windows.Point ptTopLeftDlg1 = new System.Windows.Point(mainModel.leftWidth + leftListWidth, totalTitleHeight + regionTextHeight); System.Windows.Point ptBotRightDlg1 = new System.Windows.Point(mainWnd.Width, mainWnd.Height); ptOriginalDlg = mainWnd.PointToScreen(ptOriginalDlg); ptTopLeftDlg1 = mainWnd.PointToScreen(ptTopLeftDlg1); ptBotRightDlg1 = mainWnd.PointToScreen(ptBotRightDlg1); rect1.left = Convert.ToInt32(ptTopLeftDlg1.X - ptOriginalDlg.X); rect1.top = Convert.ToInt32(ptTopLeftDlg1.Y - ptOriginalDlg.Y); rect1.right = Convert.ToInt32(ptBotRightDlg1.X - ptOriginalDlg.X); rect1.bottom = Convert.ToInt32(ptBotRightDlg1.Y - ptOriginalDlg.Y); PieChartServer.MoveChart(_pieCharIndex, rect1, true); LineChartServer.MoveChart(_lineCharIndex, rect1, true); HistogramServer.MoveChart(_histogramCharIndex, rect1, true); switch (bShowChart) { case ShowChartEnum.ShowChartEnum_Pie: region0Text = "制签饼图"; PieChartServer.ShowChart(_pieCharIndex, true); LineChartServer.ShowChart(_lineCharIndex, false); HistogramServer.ShowChart(_histogramCharIndex, false); break; case ShowChartEnum.ShowChartEnum_Line: region0Text = "制签统计图"; PieChartServer.ShowChart(_pieCharIndex, false); LineChartServer.ShowChart(_lineCharIndex, true); HistogramServer.ShowChart(_histogramCharIndex, false); break; case ShowChartEnum.ShowChartEnum_Histogram: region0Text = "制签直方图"; PieChartServer.ShowChart(_pieCharIndex, false); LineChartServer.ShowChart(_lineCharIndex, false); HistogramServer.ShowChart(_histogramCharIndex, true); break; } } else { PieChartServer.ShowChart(_pieCharIndex, false); LineChartServer.ShowChart(_lineCharIndex, false); HistogramServer.ShowChart(_histogramCharIndex, false); } }
private void miOutput_Click(object sender, EventArgs e) { SaveFileDialog pSaveDialog = new SaveFileDialog(); pSaveDialog.FileName = ""; pSaveDialog.Filter = "JPEG图片(*.JPG)|*.jpg|TIFF图片(*.TIF)|*.tif|PDF文档(*.PDF)|*.pdf)"; if (pSaveDialog.ShowDialog() == DialogResult.OK) { double iScreenDisplayResolution = axPageLayoutControl1.ActiveView.ScreenDisplay.DisplayTransformation.Resolution; IExporter pExporter = null; if (pSaveDialog.FilterIndex == 1) { pExporter = new JpegExporterClass(); } else if (pSaveDialog.FilterIndex == 2) { pExporter = new TiffExporterClass(); } else if (pSaveDialog.FilterIndex == 3) { pExporter = new PDFExporterClass(); } pExporter.ExportFileName = pSaveDialog.FileName; pExporter.Resolution = (short)iScreenDisplayResolution; tagRECT deviceRect = axPageLayoutControl1.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame(); IEnvelope pDeviceEnvelope = new EnvelopeClass(); pDeviceEnvelope.PutCoords(deviceRect.left, deviceRect.bottom, deviceRect.right, deviceRect.top); pExporter.PixelBounds = pDeviceEnvelope; ITrackCancel pCancel = new CancelTrackerClass(); axPageLayoutControl1.ActiveView.Output(pExporter.StartExporting(), pExporter.Resolution, ref deviceRect, axPageLayoutControl1.ActiveView.Extent, pCancel); Application.DoEvents(); pExporter.FinishExporting(); } }
//导出地图 public void ExportMapToImage(AxPageLayoutControl axPageLayoutControl1) { try { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.FileName = ""; saveFileDialog.Filter = "JPG图片(*.JPG)|*.jpg|tif图片(*.tif)|*.tif|PDF文档(*.PDF)|*.pdf"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { double iScreenDispalyResolution = axPageLayoutControl1.ActiveView.ScreenDisplay. DisplayTransformation.Resolution;// 获取屏幕分辨率的值 IExporter exporter = new JpegExporterClass(); exporter.ExportFileName = saveFileDialog.FileName; exporter.Resolution = (short)iScreenDispalyResolution; //分辨率 tagRECT deviceRect = axPageLayoutControl1.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame(); IEnvelope deviceEnvelope = new EnvelopeClass(); deviceEnvelope.PutCoords(deviceRect.left, deviceRect.bottom, deviceRect.right, deviceRect.top); exporter.PixelBounds = deviceEnvelope; // 输出图片的范围 ITrackCancel pCancle = new CancelTrackerClass(); //可用ESC键取消操作 axPageLayoutControl1.ActiveView.Output(exporter.StartExporting(), exporter.Resolution, ref deviceRect, axPageLayoutControl1.ActiveView.Extent, pCancle); Application.DoEvents(); exporter.FinishExporting(); } } catch (Exception Err) { MessageBox.Show(Err.Message, "输出图片", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Saves the current to image. /// </summary> /// <param name="map">The map.</param> /// <param name="outRect">The out rect.</param> /// <param name="envelope">The envelope.</param> /// <returns>Image.</returns> public Image SaveCurrentToImage(IMap map, Size outRect, IEnvelope envelope) { tagRECT tagRECT = default(tagRECT); tagRECT.left = (tagRECT.top = 0); tagRECT.right = outRect.Width; tagRECT.bottom = outRect.Height; Image result; try { IActiveView activeView = (IActiveView)map; Image image = new Bitmap(outRect.Width, outRect.Height); Graphics graphics = Graphics.FromImage(image); graphics.FillRectangle(Brushes.White, 0, 0, outRect.Width, outRect.Height); int dpi = (int)((double)outRect.Width / envelope.Width); activeView.Output(graphics.GetHdc().ToInt32(), dpi, ref tagRECT, envelope, null); graphics.ReleaseHdc(); result = image; } catch (Exception ex) { XtraMessageBox.Show(ex.Message); result = null; } return(result); }
private void InitFormSize() { //窗口初始化时读取当前数据视图的分辨率并添加到分辨率文本框中 comboBox1.Text = pActiveView.ScreenDisplay.DisplayTransformation.Resolution.ToString(); comboBox1.Items.Add(comboBox1.Text); if (isRegion)//若是区域导出,获取区域的宽和高 { IEnvelope pEnvelope = geometry.Envelope; tagRECT pRECT = new tagRECT(); pActiveView.ScreenDisplay.DisplayTransformation.TransformRect(pEnvelope, ref pRECT, 9);//获取所选择的区域 if (comboBox1.Text == "") { return; } textBox1.Text = pRECT.right.ToString(); //获取宽度 textBox2.Text = pRECT.bottom.ToString(); //获取高度 } else//全域导出,获取当前视图全域宽高 { if (comboBox1.Text == null) { return; } textBox1.Text = pActiveView.ExportFrame.right.ToString(); //获取宽度 textBox2.Text = pActiveView.ExportFrame.bottom.ToString(); //获取高度 } }
private void OnLoad(object sender, EventArgs eventArgs) { Marshal.AddRef(Marshal.GetIUnknownForObject(_webPolicyDelegate)); _webView.setPolicyDelegate(_webPolicyDelegate); Marshal.AddRef(Marshal.GetIUnknownForObject(_webFrameLoadDelegate)); _webView.setFrameLoadDelegate(_webFrameLoadDelegate); Marshal.AddRef(Marshal.GetIUnknownForObject(_webUIDelegate)); _webView.setUIDelegate(_webUIDelegate); Marshal.AddRef(Marshal.GetIUnknownForObject(_webDownloadDelegate)); _webView.setDownloadDelegate(_webDownloadDelegate); _webView.setHostWindow(this.Handle.ToInt32()); var frameRect = new tagRECT() { top = 0, left = 0, bottom = Height, right = Width }; _webView.initWithFrame(frameRect, null, null); _webView.setTransparent(TRUE); //_webView.setUsesLayeredWindow(TRUE); }
private void SaveAsImage_Shown(object sender, EventArgs e) { openFileDialog1.ShowDialog(); axPXV_Control1.CreateNewBlankDoc(500, 500, 1); var page = axPXV_Control1.Doc.CoreDoc.Pages[0]; var CC = axPXV_Control1.Doc.CoreDoc.CreateContentCreator(); //page.Document.AddImageFromFile(openFileDialog1.FileName); //axPXV_Control1.Doc.CoreDoc.WriteToFile(openFileDialog1.FileName); IXC_ImageFileFormatIDs img = IXC_ImageFileFormatIDs.FMT_PBM_ID; page.Document.WriteToFile(openFileDialog1.FileName); IXC_PageFormat nFormat = IXC_PageFormat.PageFormat_8Indexed; //ConvertFormatToIndx(page, nFormat); IXC_Channel sd = IXC_Channel.Channel_R; IIXC_Page d; axPXV_Control1.CreateNewBlankDoc(600, 600, 1); PXC_BoxType bx = new PXC_BoxType(); PXC_Matrix mtr = page.GetMatrix(bx); page.GetMatrix(bx); tagRECT tgRct = new tagRECT(); IIXC_Inst inst = (IIXC_Inst)axPXV_Control1.Inst.GetExtension("IXC"); }
private void Cmxresolution_SelectedIndexChanged(object sender, EventArgs e) { //分辨率变化输出图形也随之变化 double resolution = (int)this._Actiview.ScreenDisplay.DisplayTransformation.Resolution; if (Cmxresolution.Text == "") { this.widthtxt.Text = ""; this.heighttxt.Text = ""; return; } if (bRegion) { IEnvelope envelope = pGeometry.Envelope; tagRECT pRECT = new tagRECT(); _Actiview.ScreenDisplay.DisplayTransformation.TransformRect(envelope, ref pRECT, 9); if (Cmxresolution.Text != "") { this.widthtxt.Text = Math.Round(pRECT.right * (double.Parse(Cmxresolution.Text) / resolution)).ToString(); this.heighttxt.Text = Math.Round(pRECT.bottom * (double.Parse(Cmxresolution.Text) / resolution)).ToString(); } } else { this.widthtxt.Text = Math.Round(this._Actiview.ExportFrame.right * (double.Parse(Cmxresolution.Text) / resolution)).ToString(); this.widthtxt.Text = Math.Round(this._Actiview.ExportFrame.bottom * (double.Parse(Cmxresolution.Text) / resolution)).ToString(); } }
private void InitExportFrm() { //获取分辨率 Cmxresolution.Text = _Actiview.ScreenDisplay.DisplayTransformation.Resolution.ToString(); Cmxresolution.Items.Add(Cmxresolution.Text); //判断全部还是部分导出 if (bRegion) { IEnvelope envelope = pGeometry.Envelope; tagRECT pRect = new tagRECT(); _Actiview.ScreenDisplay.DisplayTransformation.TransformRect(envelope, ref pRect, 9); if (Cmxresolution.Text != null) { this.widthtxt.Text = pRect.right.ToString(); this.heighttxt.Text = pRect.bottom.ToString(); } } else { if (Cmxresolution.Text != null) { this.widthtxt.Text = this._Actiview.ExportFrame.right.ToString(); this.heighttxt.Text = this._Actiview.ExportFrame.bottom.ToString(); } } }
public override void Draw(int int_0, Rectangle rectangle_0, double double_0, double double_1) { IStyleGalleryClass styleGalleryClass = null; if (this.m_pStyle is IScaleBar) { styleGalleryClass = new ScaleBarStyleGalleryClass(); } else if (this.m_pStyle is IScaleText) { styleGalleryClass = new ScaleTextStyleGalleryClass(); } else if (this.m_pStyle is INorthArrow) { styleGalleryClass = new NorthArrowStyleGalleryClass(); } if (styleGalleryClass != null) { tagRECT tagRECT = default(tagRECT); tagRECT.left = rectangle_0.Left; tagRECT.right = rectangle_0.Right; tagRECT.top = rectangle_0.Top; tagRECT.bottom = rectangle_0.Bottom; styleGalleryClass.Preview(this.m_pStyle, int_0, ref tagRECT); } }
//设备句柄仿射变换 private static ITransformation CreateTransformationFromHDC(IntPtr HDC, int width, int height) { IEnvelope env = new EnvelopeClass(); env.PutCoords(0, 0, width, height); //目标矩形的大小 tagRECT frame = new tagRECT(); frame.left = 0; frame.top = 0; frame.right = width; frame.bottom = height; double dpi = Graphics.FromHdc(HDC).DpiY;//设备句柄的垂直分辨率 long lDpi = (long)dpi; if (lDpi == 0) { //XtraMessageBox.Show("获取设备比例尺失败!"); return(null); } IDisplayTransformation dispTrans = new DisplayTransformationClass(); dispTrans.Bounds = env; dispTrans.VisibleBounds = env; dispTrans.set_DeviceFrame(ref frame); dispTrans.Resolution = dpi; return(dispTrans); }
public override void Draw(int int_0, Rectangle rectangle_0, double double_0, double double_1) { if (this.m_pStyle is ISimpleTextSymbol) { string text = (this.m_pStyle as ISimpleTextSymbol).Text; if (text.Length == 0) { IStyleGalleryClass styleGalleryClass = new TextSymbolStyleGalleryClass(); tagRECT tagRECT = default(tagRECT); tagRECT.left = rectangle_0.Left; tagRECT.right = rectangle_0.Right; tagRECT.top = rectangle_0.Top; tagRECT.bottom = rectangle_0.Bottom; styleGalleryClass.Preview(this.m_pStyle, int_0, ref tagRECT); } else { this.Draw2(int_0, rectangle_0, double_0, double_1); } } else { this.Draw1(int_0, rectangle_0, double_0, double_1); } }
/// <summary> /// 地图导出 /// </summary> /// <param name="pLayoutControl">布局控件</param> /// <param name="resolution">图片分辨率</param> public static void ExportMapToImage(AxPageLayoutControl pLayoutControl, short resolution) { IExport pExport = GetExport(); if (pExport == null) { return; } IActiveView activeView = pLayoutControl.ActiveView; //获取屏幕分辨率的值 double screenDispalyResolution = activeView.ScreenDisplay.DisplayTransformation.Resolution; //获取布局页面宽度和高度 IEnvelope pEnvelope = GetPageSize(pLayoutControl); //布局坐标转为屏幕坐标 tagRECT deviceRect = new tagRECT(); activeView.ScreenDisplay.DisplayTransformation.TransformRect(pEnvelope, ref deviceRect, 9); //设置输出范围坐标 deviceRect = SetDeviceRectProperty(deviceRect, resolution, screenDispalyResolution); //设置输出图片的范围 SetExportPixelBounds(pExport, deviceRect); ITrackCancel pCancle = new CancelTrackerClass(); //可用ESC键取消操作 activeView.Output(pExport.StartExporting(), resolution, ref deviceRect, pEnvelope, pCancle); Application.DoEvents(); pExport.FinishExporting(); MessageBox.Show("导出完成"); }
//////////////////////////输出当前视图 public static void ExportWindow(AxMapControl MapCtrl) { SaveFileDialog pSaveDialog = new SaveFileDialog(); pSaveDialog.FileName = ""; pSaveDialog.Filter = "JPG图片(*.JPG)|*.jpg|tif图片(*.tif)|*.tif"; if (pSaveDialog.ShowDialog() == DialogResult.OK) { double iScreenDispalyResolution = MapCtrl.ActiveView.ScreenDisplay.DisplayTransformation.Resolution; IExporter pExporter = null; if (pSaveDialog.FilterIndex == 1) { pExporter = new JpegExporterClass(); } else if (pSaveDialog.FilterIndex == 2) { pExporter = new TiffExporterClass(); } pExporter.ExportFileName = pSaveDialog.FileName; pExporter.Resolution = (short)iScreenDispalyResolution; tagRECT deviceRect = MapCtrl.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame(); IEnvelope pDeviceEnvelope = new EnvelopeClass(); pDeviceEnvelope.PutCoords(deviceRect.left, deviceRect.bottom, deviceRect.right, deviceRect.top); pExporter.PixelBounds = pDeviceEnvelope; ITrackCancel pCancle = new CancelTrackerClass(); MapCtrl.ActiveView.Output(pExporter.StartExporting(), pExporter.Resolution, ref deviceRect, MapCtrl.ActiveView.Extent, pCancle); pExporter.FinishExporting(); } }
private void GeneratePreview() { if ((picStylePreview == null) || (g_pGxView == null)) return; tagRECT r = new tagRECT(); r.bottom = picStylePreview.ClientSize.Height; r.top = 0; r.right = picStylePreview.ClientSize.Width; r.left = 0; bmpPreview = new Bitmap(r.right, r.bottom); System.Drawing.Graphics GrpObj = Graphics.FromImage(bmpPreview); try { g_pGxView.PreviewItem((Int64)GrpObj.GetHdc(), r); GrpObj.ReleaseHdc(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { GrpObj.Dispose(); } picStylePreview.Image = bmpPreview; }
private void GeneratePreview() { if ((picStylePreview == null) || (g_pGxView == null)) { return; } tagRECT r = new tagRECT(); r.bottom = picStylePreview.ClientSize.Height; r.top = 0; r.right = picStylePreview.ClientSize.Width; r.left = 0; bmpPreview = new Bitmap(r.right, r.bottom); System.Drawing.Graphics GrpObj = Graphics.FromImage(bmpPreview); try { g_pGxView.PreviewItem((Int64)GrpObj.GetHdc(), r); GrpObj.ReleaseHdc(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { GrpObj.Dispose(); } picStylePreview.Image = bmpPreview; }
public void ResizeBorder(ref tagRECT prcBorder, IntPtr pUIWindow, int fRameWindow) { if (this.m_defaultUIHandler != null) { this.m_defaultUIHandler.ResizeBorder(ref prcBorder, pUIWindow, fRameWindow); } }
private IColor GetColorByColorPalette(int left, int top) { IColor pColor; pColor = new RgbColorClass(); pColor.RGB = 255; try { IColorPalette pPalette; pPalette = new ColorPaletteClass(); tagRECT pRect = new tagRECT(); pRect.left = left; pRect.top = top; pPalette.TrackPopupMenu(ref pRect, pColor, false, 0); pColor = pPalette.Color; return(pColor); } catch (Exception ex) { MessageBox.Show(ex.Message); return(pColor); } }
public tagRECT webViewPrintingMarginRect(WebView WebView) { PageSettings settings = owner.PageSettings; // WebKit specifies margins in 1000ths of an inch. (???) // PrinterResolution.Y returns 0 for some reason, // on Adobe distiller anyway, so we'll use X for the moment. int dpi = settings.PrinterResolution.X; int marginLeft = settings.Margins.Left; int marginRight = settings.Margins.Right; int marginTop = settings.Margins.Top; int marginBottom = settings.Margins.Bottom; int pageWidth = settings.PaperSize.Width; int pageHeight = settings.PaperSize.Height; // TODO: find out what these are actually supposed to be // the x10 and x20 are completely arbitrary, based on // what I found fits an A4 portrait page with 1 inch // margins... tagRECT rect = new tagRECT(); rect.left = marginLeft; rect.top = marginTop; rect.right = marginRight * 10; rect.bottom = marginBottom * 20; return(rect); /*rect.left = 20; * rect.top = 20; * rect.right = 400; * rect.bottom = 400; * return rect;*/ }
// ArcGIS Snippet Title: // Create JPEG from ActiveView // // Long Description: // Creates a .jpg (JPEG) file from IActiveView. Default values of 96 DPI are used for the image creation. // // Add the following references to the project: // ESRI.ArcGIS.Carto // ESRI.ArcGIS.Display // ESRI.ArcGIS.Geometry // ESRI.ArcGIS.Output // ESRI.ArcGIS.System // // Intended ArcGIS Products for this snippet: // ArcGIS Desktop (ArcEditor, ArcInfo, ArcView) // ArcGIS Engine // ArcGIS Server // // Applicable ArcGIS Product Versions: // 9.2 // 9.3 // 9.3.1 // 10.0 // // Required ArcGIS Extensions: // (NONE) // // Notes: // This snippet is intended to be inserted at the base level of a Class. // It is not intended to be nested within an existing Method. // ///<summary>Creates a .jpg (JPEG) file from IActiveView. Default values of 96 DPI are used for the image creation.</summary> /// ///<param name="activeView">An IActiveView interface</param> ///<param name="pathFileName">A System.String that the path and filename of the JPEG you want to create. Example: "C:\temp\test.jpg"</param> /// ///<returns>A System.Boolean indicating the success</returns> /// ///<remarks></remarks> public System.Boolean CreateJPEGFromActiveView(ESRI.ArcGIS.Carto.IActiveView activeView, System.String pathFileName) { //parameter check if (activeView == null || !(pathFileName.EndsWith(".jpg"))) { return(false); } IExport export = (IExport) new ExportJPEG(); export.ExportFileName = pathFileName; // Microsoft Windows default DPI resolution export.Resolution = 96; tagRECT exportRECT = activeView.ExportFrame; ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass(); envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom); export.PixelBounds = envelope; System.Int32 hDC = export.StartExporting(); activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null); // Finish writing the export file and cleanup any intermediate files export.FinishExporting(); export.Cleanup(); return(true); }
/// <summary> /// 实现将Symbol转换为Bitmap /// </summary> /// <param name="Symbol">符号对象</param> /// <param name="Width">宽度值</param> /// <param name="Height">高度值</param> /// <returns>图像对象</returns> public static Bitmap PreviewItem(ISymbol Symbol, int Width, int Height) { Bitmap bitmap = new Bitmap(Width, Height); Graphics mGraphics = Graphics.FromImage(bitmap); double dpi = mGraphics.DpiY; IEnvelope pEnvelope = new EnvelopeClass(); pEnvelope.PutCoords(0, 0, bitmap.Width, bitmap.Height); tagRECT myRect = new tagRECT(); myRect.bottom = bitmap.Height; myRect.left = 0; myRect.right = bitmap.Width; myRect.top = 0; IDisplayTransformation pDisplayTransformation = new DisplayTransformationClass(); pDisplayTransformation.VisibleBounds = pEnvelope; pDisplayTransformation.Bounds = pEnvelope; pDisplayTransformation.set_DeviceFrame(ref myRect); pDisplayTransformation.Resolution = dpi; IntPtr pIntPtr = mGraphics.GetHdc(); int hDC = pIntPtr.ToInt32(); Symbol.SetupDC(hDC, pDisplayTransformation); IGeometry pGeometry = GetSymbolGeometry(Symbol, pEnvelope); Symbol.Draw(pGeometry); Symbol.ResetDC(); mGraphics.ReleaseHdc(pIntPtr); mGraphics.Dispose(); return(bitmap); }
private void cmbResolution_SelectedIndexChanged(object sender, EventArgs e) { double num = (int)Math.Round(pActiveView.ScreenDisplay.DisplayTransformation.Resolution); if (cmbResolution.Text == "") { tbxWidth.Text = ""; tbxHeight.Text = ""; return; } if (bRegion) { IEnvelope pEnvelope = pGeometry.Envelope; tagRECT pRECT = new tagRECT(); pActiveView.ScreenDisplay.DisplayTransformation.TransformRect(pEnvelope, ref pRECT, 9); if (cmbResolution.Text != "") { tbxWidth.Text = Math.Round((double)(pRECT.right * (double.Parse(cmbResolution.Text) / (double)num))).ToString(); tbxHeight.Text = Math.Round((double)(pRECT.bottom * (double.Parse(cmbResolution.Text) / (double)num))).ToString(); } } else { tbxWidth.Text = Math.Round((double)(pActiveView.ExportFrame.right * (double.Parse(cmbResolution.Text) / (double)num))).ToString(); tbxHeight.Text = Math.Round((double)(pActiveView.ExportFrame.bottom * (double.Parse(cmbResolution.Text) / (double)num))).ToString(); } }
public static IEnvelope GetSearchEnvelope(IActiveView pActiveView, IPoint pPoint) { try { double num = 6.0; IEnvelope visibleBounds = null; if (pActiveView != null) { IDisplayTransformation displayTransformation = pActiveView.ScreenDisplay.DisplayTransformation; visibleBounds = displayTransformation.VisibleBounds; tagRECT deviceFrame = displayTransformation.get_DeviceFrame(); double height = 0.0; long num3 = 0L; height = visibleBounds.Height; num3 = deviceFrame.bottom - deviceFrame.top; double num4 = 0.0; num4 = height / ((double)num3); num *= num4; } if (pPoint == null) { return(null); } visibleBounds = pPoint.Envelope; visibleBounds.Width = num; visibleBounds.Height = num; visibleBounds.CenterAt(pPoint); return(visibleBounds); } catch (Exception) { return(null); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) //属性值发生改变时 { double num = (int)Math.Round(pActiveView.ScreenDisplay.DisplayTransformation.Resolution); //获取当前视图显示的分辨率 if (comboBox1.Text == "") { textBox1.Text = ""; textBox2.Text = ""; return; } if (isRegion) { IEnvelope pEnvelope = geometry.Envelope; tagRECT pRECT = new tagRECT(); pActiveView.ScreenDisplay.DisplayTransformation.TransformRect(pEnvelope, ref pRECT, 9);//获取区域 if (comboBox1.Text == "") { return; } //输出图片的宽=当前视图的宽*输出图片的分辨率/当前数据视图显示的分辨率 textBox1.Text = Math.Round(pRECT.right * (double.Parse(comboBox1.Text) / num)).ToString(); textBox2.Text = Math.Round(pRECT.bottom * (double.Parse(comboBox1.Text) / num)).ToString(); } else { textBox1.Text = Math.Round(pActiveView.ExportFrame.right * (double.Parse(comboBox1.Text) / num)).ToString(); textBox2.Text = Math.Round(pActiveView.ExportFrame.bottom * (double.Parse(comboBox1.Text) / num)).ToString(); } }
public static bool Contains(this tagRECT rect, Point point) { return(point.X >= rect.left && point.X <= rect.right && point.Y >= rect.top && point.Y <= rect.bottom); }
/// <summary> /// draw the numbers (azimuth) in the HUD /// </summary> /// <param name="deviceFrame"></param> /// <param name="angle"></param> private void DrawAzimuths(tagRECT deviceFrame, float angle) { //need to draw the current azimuth m_dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.8f, 0.0f, 1.0f); // Green //assign the item's glyph to the dynamic-symbol m_dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph); //get the floor of the azimuth float azimuth = 180.0f - angle; if (azimuth > 360) { azimuth -= 360; } else if (azimuth < 0) { azimuth += 360; } float floorAzi = (int)(azimuth / 10.0f) * 10.0f; double deltaAzi = (angle - (float)((int)(angle / 10.0f) * 10.0f)) * 6.0; //(the shift to the X axis) double xmin = (double)deviceFrame.left; double xmax = (double)deviceFrame.right; double ymin = (double)deviceFrame.top; double xmiddle = (xmax + xmin) / 2.0; double x = xmiddle - 150.0 + deltaAzi; double dAzStartMiddle = (150.0 - 2.0 * deltaAzi) / 6.0; dAzStartMiddle = (int)(dAzStartMiddle / 60.0) * 60.0 + 10.0; int azi = (int)(floorAzi - dAzStartMiddle) - 5; double delta = 60.0; m_dynamicSymbolProps.set_Heading(esriDynamicSymbolType.esriDSymbolText, 0.0f); m_dynamicSymbolProps.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolText, esriDynamicSymbolRotationAlignment.esriDSRAScreen); for (int i = 0; i < 5; i++) { m_point.PutCoords(x, ymin + 28.0); if (azi > 360) { azi -= 360; } else if (azi < 0) { azi += 360; } m_dynamicDrawScreen.DrawScreenText(m_point, azi.ToString()); azi += 10; x += delta; } //need to draw the current azimuth m_dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.0f, 0.0f, 1.0f); // Black m_point.PutCoords(xmiddle, ymin + 95.0); m_dynamicDrawScreen.DrawScreenText(m_point, azimuth.ToString("###")); }
public static ITransformation CreateTransformationFromHDC(IntPtr HDC, int width, int height) { IEnvelope env = new Envelope() as IEnvelope; env.PutCoords(0, 0, width, height); tagRECT frame = new tagRECT(); frame.left = 0; frame.top = 0; frame.right = width; frame.bottom = height; double dpi = Graphics.FromHdc(HDC).DpiY; long lDpi = (long)dpi; if (lDpi == 0) { System.Windows.Forms.MessageBox.Show("获取设备比例尺失败!"); return(null); } IDisplayTransformation dispTrans = new DisplayTransformation() as IDisplayTransformation; dispTrans.Bounds = env; dispTrans.VisibleBounds = env; dispTrans.set_DeviceFrame(ref frame); dispTrans.Resolution = dpi; return(dispTrans); }
public static ITransformation CreateTransformationFromHDC(IntPtr HDC, int width, int height) { ITransformation transformation; IEnvelope envelopeClass = new Envelope() as IEnvelope; envelopeClass.PutCoords(0, 0, (double)width, (double)height); tagRECT _tagRECT = new tagRECT() { left = 0, top = 0, right = width, bottom = height }; double dpiY = (double)Graphics.FromHdc(HDC).DpiY; if ((long)dpiY != (long)0) { IDisplayTransformation displayTransformationClass = new DisplayTransformation() as IDisplayTransformation; displayTransformationClass.Bounds = envelopeClass; displayTransformationClass.VisibleBounds = envelopeClass; displayTransformationClass.set_DeviceFrame(ref _tagRECT); displayTransformationClass.Resolution = dpiY; transformation = displayTransformationClass; } else { MessageBoxHelper.ShowMessageBox("获取设备比例尺失败"); transformation = null; } return(transformation); }
/// <summary> /// 将像素转换成地图单元 /// </summary> /// <param name="pActiveView">提供各种转换信息</param> /// <param name="pixelUnits">像素单元</param> /// <returns>像素单元大小</returns> public static double ConvertPixelsToMapUnits(IActiveView pActiveView, double pixelUnits) { if (pActiveView == null) { return(-1); } //获取 the ScreenDisplay IScreenDisplay screenDisplay = pActiveView.ScreenDisplay; //获取 DisplayTransformation IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation; //获取一个设备帧并用它来获得x轴方向上的像素数 tagRECT deviceRECT = displayTransformation.get_DeviceFrame(); int pixelExtent = (deviceRECT.right - deviceRECT.left); //获取当前可是区域的地图范围 IEnvelope envelope = displayTransformation.VisibleBounds; double realWorldDisplayExtent = envelope.Width; //计算一个像素大小 if (pixelExtent == 0) { return(-1); } double sizeOfOnePixel = (realWorldDisplayExtent / pixelExtent); //得出像素单元大小 return(pixelUnits * sizeOfOnePixel); }
private static double GetLengthInMapUnits(IActiveView activeView, double mm) { if (activeView == null) { return(-1); } IScreenDisplay screenDisplay = activeView.ScreenDisplay; IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation; var dpi = displayTransformation.Resolution; var inches = mm / 25.4; tagRECT deviceRect = displayTransformation.get_DeviceFrame(); int pixelExtent = (deviceRect.right - deviceRect.left); var pixels = dpi * inches; IDistanceConverter distanceConverter = new DistanceConverter(); IEnvelope envelope = displayTransformation.VisibleBounds; double realWorldDisplayExtent = envelope.Width; if (pixelExtent == 0) { return(-1); } var sizeOfOnePixel = (realWorldDisplayExtent / pixelExtent); return(pixels * sizeOfOnePixel); }
/// <summary> /// 设置输出图片的范围 /// </summary> /// <param name="pExport">输出</param> /// <param name="deviceRect">输出范围</param> private static void SetExportPixelBounds(IExport pExport, tagRECT deviceRect) { IEnvelope pDeviceEnvelope = new EnvelopeClass(); pDeviceEnvelope.PutCoords(deviceRect.left, deviceRect.bottom, deviceRect.right, deviceRect.top); pExport.PixelBounds = pDeviceEnvelope; // 输出图片的范围 }
public void PreviewItem(IStyleGalleryItem pItem, int hDC, tagRECT r) { //Draw a representation of the item to the given DC. try { m_pClass.Preview(pItem.Item, hDC, ref r); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } }
public Bitmap PreviewSymbol(IStyleGalleryClass pStyleGalleryClass, object galleryItem, int imgWidth, int imgHeight) { Bitmap bitmap = new Bitmap(imgWidth, imgHeight); Graphics graphics = Graphics.FromImage(bitmap); tagRECT rect = new tagRECT(); rect.right = bitmap.Width; rect.bottom = bitmap.Height; System.IntPtr hdc = graphics.GetHdc(); pStyleGalleryClass.Preview(galleryItem, hdc.ToInt32(), ref rect); graphics.ReleaseHdc(hdc); graphics.Dispose(); return bitmap; }
public static Bitmap StyleGalleryItemToBmp(int pWidth, int pHeight, IStyleGalleryClass pStyleGalleryClass, IStyleGalleryItem pStyleGalleryItem) { /// 通过符号库中的IStyleGalleryItem 和 IStyleGalleryClass类别生成图片预览 Bitmap bitmap = new Bitmap(pWidth, pHeight); System.Drawing.Graphics pGraphics = System.Drawing.Graphics.FromImage(bitmap); tagRECT rect = new tagRECT(); rect.right = bitmap.Width; rect.bottom = bitmap.Height; //生成预览 IntPtr hdc = new IntPtr(); hdc = pGraphics.GetHdc(); pStyleGalleryClass.Preview(pStyleGalleryItem.Item, hdc.ToInt32(), ref rect); pGraphics.ReleaseHdc(hdc); pGraphics.Dispose(); return bitmap; }
protected override void OnClick(EventArgs e) { base.OnClick(e); tagRECT rect = new tagRECT(); GetWindowRect(this.Handle, ref rect); IColorPalette pColorPalette = new ColorPaletteClass(); IColor pInColor = new RgbColorClass(); pInColor.Transparency = 255; if (m_IsNoColor == true) pInColor.NullColor = true; else { if (m_ESRIColor == null) pInColor.RGB = ConvertSystemColorToESRIColor(m_SystemColor.ToArgb()); else { pInColor.RGB = m_ESRIColor.RGB; } } bool bSelectColor = false; bSelectColor = pColorPalette.TrackPopupMenu(ref rect, pInColor, false, this.Handle.ToInt32()); if (bSelectColor == true) { m_ESRIColor = pColorPalette.Color; if (m_ESRIColor.NullColor != true) { m_IsNoColor = false; m_SystemColor = Color.FromArgb(ConvertSystemColorToESRIColor(m_ESRIColor.RGB)); } else { m_IsNoColor = true; m_SystemColor = this.BackColor; } Invalidate(); } }
/// <summary> /// DynamicMap AfterDynamicDraw event handler method /// </summary> /// <param name="DynamicMapDrawPhase"></param> /// <param name="Display"></param> /// <param name="dynamicDisplay"></param> void OnAfterDynamicDraw(esriDynamicMapDrawPhase DynamicMapDrawPhase, IDisplay Display, IDynamicDisplay dynamicDisplay) { try { if (DynamicMapDrawPhase != esriDynamicMapDrawPhase.esriDMDPDynamicLayers) return; //make sure that the display is valid as well as that the layer is visible if (null == dynamicDisplay || null == Display) return; if (m_bOnce) { //get the device frame size m_deviceFrame = Display.DisplayTransformation.get_DeviceFrame(); //start listening to display events ((ITransformEvents_Event)Display.DisplayTransformation).DeviceFrameUpdated += new ITransformEvents_DeviceFrameUpdatedEventHandler(OnDeviceFrameUpdated); CreateDisplayLists(); m_bOnce = false; } GL.glPushMatrix(); GL.glLoadIdentity(); //draw the compass list GL.glPushMatrix(); GL.glTranslatef((float)m_deviceFrame.left + 70.0f, (float)m_deviceFrame.top + 70.0f, 0.0f); GL.glScalef(90.0f, 90.0f, 0.0f); GL.glRotatef((float)Display.DisplayTransformation.Rotation, 0.0f, 0.0f, 1.0f); GL.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL.glCallList(m_compassList); GL.glPopMatrix(); GL.glPopMatrix(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }
protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg) { int X = arg.X; int Y = arg.Y; IMxApplication pMxApp = null; IMxDocument pMxDoc = null; pMxApp = (IMxApplication)ArcMap.Application; pMxDoc = (IMxDocument)ArcMap.Application.Document; // calculate tolerance rectangle to identify features inside it int Tolerance = 0; Tolerance = pMxDoc.SearchTolerancePixels; IDisplayTransformation pDispTrans = null; pDispTrans = pMxApp.Display.DisplayTransformation; tagRECT pToleranceRect = new tagRECT(); pToleranceRect.left = X - Tolerance; pToleranceRect.right = X + Tolerance; pToleranceRect.top = Y - Tolerance; pToleranceRect.bottom = Y + Tolerance; IEnvelope pSearchEnvelope = null; pSearchEnvelope = new EnvelopeClass(); pDispTrans.TransformRect(pSearchEnvelope, ref pToleranceRect, (int)(esriDisplayTransformationEnum.esriTransformPosition | esriDisplayTransformationEnum.esriTransformToMap)); // identify feature points of measurement IBasicDocument pBasicDoc = null; pBasicDoc = (IBasicDocument)ArcMap.Application.Document; pSearchEnvelope.SpatialReference = pMxDoc.ActiveView.FocusMap.SpatialReference; IIdentify pIdentify = null; pIdentify = (IIdentify)pMxDoc.FocusMap.get_Layer(0); if (pIdentify == null) { MessageBox.Show("No layer"); return; } IArray pIDArray = null; pIDArray = pIdentify.Identify(pSearchEnvelope); // get object from feature point IIdentifyObj pIDObj = null; if (pIDArray != null) pIDObj = (IIdentifyObj)pIDArray.get_Element(0); if (pIDObj == null) { MessageBox.Show("No feature was identified"); return; } // get the name of the layer containing feature points ILayer pLayer = null; pLayer = pMxDoc.FocusMap.get_Layer(0); string layerName = null; layerName = pLayer.Name; // get primary display field for measurement values and set names of a date/time field and gage ID field IFeatureLayer pFeatLayer = null; pFeatLayer = (IFeatureLayer)pLayer; string dataFldName = null; string timefldName = null; string gageIDFldName = null; dataFldName = "TSValue"; timefldName = "TSDateTime"; // substitute data/time field name for different dataset gageIDFldName = "Name"; // substitute gage ID field name for different dataset // get display table from layer ITable pTable = null; IDisplayTable pDisplayTable = null; pDisplayTable = (IDisplayTable)pLayer; if (pDisplayTable != null) { pTable = pDisplayTable.DisplayTable; if (pTable == null) goto THEEND; } // get fields from display table IFields pFields = null; pFields = pTable.Fields; long fldCount = 0; fldCount = pFields.FieldCount; // create WHERE clause from identified objects of measurement points int gageIDFldIdx = 0; gageIDFldIdx = pFields.FindField(gageIDFldName); IRowIdentifyObject pRowIDObj = null; pRowIDObj = (IRowIdentifyObject)pIDObj; string gageID = null; gageID = (string)pRowIDObj.Row.get_Value(gageIDFldIdx); IFeatureLayerDefinition pFeatureLayerDef = null; pFeatureLayerDef = (IFeatureLayerDefinition)pLayer; string definitionExpression = null; definitionExpression = pFeatureLayerDef.DefinitionExpression; string whereClause = null; if (definitionExpression == "") whereClause = "[" + gageIDFldName + "] = '" + gageID + "'"; else whereClause = "[" + gageIDFldName + "] = '" + gageID + "' AND " + definitionExpression; //find color for the identified object from feature layer's renderer IGeoFeatureLayer pGeoFeatureLayer = null; pGeoFeatureLayer = (IGeoFeatureLayer)pLayer; ILookupSymbol pLookupSymbol = null; pLookupSymbol = (ILookupSymbol)pGeoFeatureLayer.Renderer; IFeature pFeature = null; pFeature = (IFeature)pRowIDObj.Row; IMarkerSymbol pSymbol = null; pSymbol = (IMarkerSymbol)pLookupSymbol.LookupSymbol(false, pFeature); // Find an opened GraphWindow IDataGraphBase pDataGraphBase = null; IDataGraphT pDataGraphT = null; IDataGraphWindow2 pDGWin = null; IDataGraphCollection pDataGraphs = null; pDataGraphs = (IDataGraphCollection)pMxDoc; int grfCount = 0; grfCount = pDataGraphs.DataGraphCount; for (int i = 0; i < grfCount; i++) { pDataGraphBase = pDataGraphs.get_DataGraph(i); pDGWin = FindGraphWindow(ref pDataGraphBase); if (pDGWin != null) break; } // if there is not an opened graph window - create a new graph for if (pDGWin == null) { // create graph pDataGraphT = new DataGraphTClass(); pDataGraphBase = (IDataGraphBase)pDataGraphT; // load template from <ARCGISHOME>\GraphTemplates\ string strPath = null; strPath = Environment.GetEnvironmentVariable("ARCGISHOME"); try { pDataGraphT.LoadTemplate(strPath + @"GraphTemplates\timeseries.tee"); } catch { } // graph, axis and legend titles. Substitute them for different input layer pDataGraphT.GeneralProperties.Title = "Daily Streamflow for Guadalupe Basin in 1999"; pDataGraphT.LegendProperties.Title = "Monitoring Point"; pDataGraphT.get_AxisProperties(0).Title = "Streamflow (cfs)"; pDataGraphT.get_AxisProperties(0).Logarithmic = true; pDataGraphT.get_AxisProperties(2).Title = "Date"; pDataGraphBase.Name = layerName; } else // get graph from the opened window pDataGraphT = (IDataGraphT)pDataGraphBase; // create vertical line series for all measurements for the identified gage ISeriesProperties pSP = null; pSP = pDataGraphT.AddSeries("line:vertical"); pSP.ColorType = esriGraphColorType.esriGraphColorCustomAll; pSP.CustomColor = pSymbol.Color.RGB; pSP.WhereClause = whereClause; pSP.InLegend = true; pSP.Name = gageID; pSP.SourceData = pLayer; pSP.SetField(0, timefldName); pSP.SetField(1, dataFldName); IDataSortSeriesProperties pSortFlds = null; pSortFlds = (IDataSortSeriesProperties)pSP; int idx = 0; pSortFlds.AddSortingField(timefldName, true, ref idx); pDataGraphBase.UseSelectedSet = true; ITrackCancel pCancelTracker = null; pCancelTracker = new CancelTracker(); pDataGraphT.Update(pCancelTracker); // create data graph window if there is not any opened one if (pDGWin == null) { pDGWin = new DataGraphWindowClass(); pDGWin.DataGraphBase = pDataGraphBase; pDGWin.Application = ArcMap.Application; pDGWin.Show(true); pDataGraphs.AddDataGraph(pDataGraphBase); } THEEND: return; //base.OnMouseDown(arg); }
public tagRECT webViewPrintingMarginRect(WebView WebView) { PageSettings settings = owner.PageSettings; // WebKit specifies margins in 1000ths of an inch. // PrinterResolution.Y returns 0 for some reason, // on Adobe distiller anyway, so we'll use X for the moment. int dpi = settings.PrinterResolution.X; int marginLeft = settings.Margins.Left; int marginRight = settings.Margins.Right; int marginTop = settings.Margins.Top; int marginBottom = settings.Margins.Bottom; tagRECT rect = new tagRECT(); rect.left = marginLeft * 10; rect.top = marginTop * 10; rect.right = marginRight * 10; rect.bottom = marginBottom * 10; return rect; }
public void setContentRect(WebView sender, ref tagRECT contentRect) { }
public void paintCustomScrollbar(WebView WebView, int hDC, tagRECT rect, WebScrollBarControlSize size, uint state, WebScrollbarControlPart pressedPart, int vertical, float value, float proportion, uint parts) { }
public void drawFooterInRect(WebView WebView, ref tagRECT rect, int drawingContext, uint pageIndex, uint pageCount) { }
public static extern void SendMessage(HandleRef hWnd, uint msg, IntPtr wParam, ref tagRECT lParam);
public override void OnMouseDown(int Button, int Shift, int X, int Y) { IMap map; IPoint clickedPoint = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); //If ActiveView is a PageLayout if (m_hookHelper.ActiveView is IPageLayout) { //See whether the mouse has been clicked over a Map in the PageLayout map = m_hookHelper.ActiveView.HitTestMap(clickedPoint); //If mouse click isn't over a Map exit if (map == null) return; //Ensure the Map is the FocusMap if ((!object.ReferenceEquals(map, m_hookHelper.FocusMap))) { m_hookHelper.ActiveView.FocusMap = map; m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } //Still need to convert the clickedPoint into map units using the map's IActiveView clickedPoint = ((IActiveView)map).ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y); } else //Or ActiveView is a Map { map = m_hookHelper.FocusMap; } IActiveView activeView = (IActiveView)map; IRubberBand rubberEnv = new RubberEnvelopeClass(); IGeometry geom = rubberEnv.TrackNew(activeView.ScreenDisplay, null); IArea area = (IArea)geom; //Extra logic to cater for the situation where the user simply clicks a point on the map //or where envelope is so small area is zero if ((geom.IsEmpty == true) || (area.Area == 0)) { //create a new envelope IEnvelope tempEnv = new EnvelopeClass(); //create a small rectangle ESRI.ArcGIS.esriSystem.tagRECT RECT = new tagRECT(); RECT.bottom = 0; RECT.left = 0; RECT.right = 5; RECT.top = 5; //transform rectangle into map units and apply to the tempEnv envelope IDisplayTransformation dispTrans = activeView.ScreenDisplay.DisplayTransformation; dispTrans.TransformRect(tempEnv,ref RECT, 4); //4 = esriDisplayTransformationEnum.esriTransformToMap) tempEnv.CenterAt(clickedPoint); geom = (IGeometry)tempEnv; } //Set the spatial reference of the search geometry to that of the Map ISpatialReference spatialReference = map.SpatialReference; geom.SpatialReference = spatialReference; map.SelectByShape(geom, null, false); activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent); }
/// <summary> /// Create Bitmap From ESRI Dataset /// </summary> /// <param name="dataset">Dataset to generate an image from</param> /// <param name="imageFormat">Output image format</param> /// <param name="size">Size of output image</param> /// <param name="resolution">Resolution of output image (dpi)</param> /// <param name="background">Background color</param> /// <param name="filename">Ouput filename</param> public static void CreateBitmap(IDataset dataset, esriImageFormat imageFormat, Size size, ushort resolution, Color background, string filename) { ILayer layer = null; switch (dataset.Type) { case esriDatasetType.esriDTFeatureClass: IFeatureClass featureClass = (IFeatureClass)dataset; switch (featureClass.FeatureType) { case esriFeatureType.esriFTDimension: layer = new DimensionLayerClass(); break; case esriFeatureType.esriFTAnnotation: layer = new FeatureLayerClass(); IGeoFeatureLayer geoFeaureLayer = (IGeoFeatureLayer)layer; geoFeaureLayer.DisplayAnnotation = true; break; case esriFeatureType.esriFTComplexEdge: case esriFeatureType.esriFTComplexJunction: case esriFeatureType.esriFTSimple: case esriFeatureType.esriFTSimpleEdge: case esriFeatureType.esriFTSimpleJunction: layer = new FeatureLayerClass(); break; } if (layer == null) { return; } IFeatureLayer featureLayer = (IFeatureLayer)layer; featureLayer.FeatureClass = featureClass; break; case esriDatasetType.esriDTRasterDataset: layer = new RasterLayerClass(); IRasterLayer rasterLayer = (IRasterLayer)layer; rasterLayer.CreateFromDataset((IRasterDataset)dataset); break; default: string message = string.Format("[{0}] is not supported", dataset.Type.ToString()); throw new Exception(message); } if (layer == null) { return; } // Create In-memory Map IMap map = new MapClass(); map.AddLayer(layer); IActiveView activeView = (IActiveView)map; IExport export = null; tagRECT rect = new tagRECT(); // Set Format Specific Properties switch (imageFormat) { case esriImageFormat.esriImageJPG: export = new ExportJPEGClass(); IExportJPEG exportJpeg = (IExportJPEG)export; exportJpeg.ProgressiveMode = false; exportJpeg.Quality = 100; break; default: throw new Exception("[" + imageFormat.ToString() + "] is not supported"); } if (export == null) { throw new Exception("Failed to Created Exporter"); } // Set Background if ((export is IExportBMP) || (export is IExportGIF) || (export is IExportJPEG) || (export is IExportPNG) || (export is IExportTIFF)) { IExportImage exportImage = (IExportImage)export; exportImage.ImageType = esriExportImageType.esriExportImageTypeTrueColor; exportImage.BackgroundColor = GeodatabaseUtility.ToESRIColor(background); } // Set Export Frame rect = activeView.ExportFrame; rect.left = 0; rect.top = 0; rect.right = size.Width; rect.bottom = size.Height; // Set Output Extent IEnvelope envelope = new EnvelopeClass(); envelope.PutCoords(rect.left, rect.top, rect.right, rect.bottom); export.PixelBounds = envelope; export.Resolution = resolution; export.ExportFileName = filename; // Export map to image int intHdc = export.StartExporting(); activeView.Output(intHdc, resolution, ref rect, null, null); export.FinishExporting(); export.Cleanup(); // Clear Layers map.ClearLayers(); // Release COM Objects GeodatabaseUtility.ReleaseComObject(layer); GeodatabaseUtility.ReleaseComObject(envelope); GeodatabaseUtility.ReleaseComObject(map); GeodatabaseUtility.ReleaseComObject(activeView); GeodatabaseUtility.ReleaseComObject(export); GC.Collect(); GC.WaitForPendingFinalizers(); }
public void PreviewItem(int hDC, tagRECT r) { m_pParent.PreviewItem(m_pItem, hDC, r); }
private void InitializeWebKit() { activationContext.Activate(); resourceLoadDelegate = new WebResourceLoadDelegate(); Marshal.AddRef(Marshal.GetIUnknownForObject(resourceLoadDelegate)); frameLoadDelegate = new WebFrameLoadDelegate(); Marshal.AddRef(Marshal.GetIUnknownForObject(frameLoadDelegate)); downloadDelegate = new WebDownloadDelegate(); Marshal.AddRef(Marshal.GetIUnknownForObject(downloadDelegate)); policyDelegate = new WebPolicyDelegate(AllowNavigation, AllowDownloads, AllowNewWindows); Marshal.AddRef(Marshal.GetIUnknownForObject(policyDelegate)); uiDelegate = new WebUIDelegate(this); Marshal.AddRef(Marshal.GetIUnknownForObject(uiDelegate)); webView.setPolicyDelegate(policyDelegate); webView.setFrameLoadDelegate(frameLoadDelegate); webView.setDownloadDelegate(downloadDelegate); webView.setUIDelegate(uiDelegate); webView.setHostWindow(this.Handle.ToInt32()); tagRECT rect = new tagRECT(); rect.top = rect.left = 0; rect.bottom = this.Height - 1; rect.right = this.Width - 1; webView.initWithFrame(rect, null, null); IWebViewPrivate webViewPrivate = (IWebViewPrivate)webView; webViewHWND = (IntPtr) webViewPrivate.viewWindow(); // Subscribe to FrameLoadDelegate events frameLoadDelegate.DidRecieveTitle += new DidRecieveTitleEvent(frameLoadDelegate_DidRecieveTitle); frameLoadDelegate.DidFinishLoadForFrame += new DidFinishLoadForFrameEvent(frameLoadDelegate_DidFinishLoadForFrame); frameLoadDelegate.DidStartProvisionalLoadForFrame += new DidStartProvisionalLoadForFrameEvent(frameLoadDelegate_DidStartProvisionalLoadForFrame); frameLoadDelegate.DidCommitLoadForFrame += new DidCommitLoadForFrameEvent(frameLoadDelegate_DidCommitLoadForFrame); frameLoadDelegate.DidFailLoadWithError += new DidFailLoadWithErrorEvent(frameLoadDelegate_DidFailLoadWithError); frameLoadDelegate.DidFailProvisionalLoadWithError += new DidFailProvisionalLoadWithErrorEvent(frameLoadDelegate_DidFailProvisionalLoadWithError); // DownloadDelegate events downloadDelegate.DidReceiveResponse += new DidReceiveResponseEvent(downloadDelegate_DidReceiveResponse); downloadDelegate.DidReceiveDataOfLength += new DidReceiveDataOfLengthEvent(downloadDelegate_DidReceiveDataOfLength); downloadDelegate.DecideDestinationWithSuggestedFilename += new DecideDestinationWithSuggestedFilenameEvent(downloadDelegate_DecideDestinationWithSuggestedFilename); downloadDelegate.DidBegin += new DidBeginEvent(downloadDelegate_DidBegin); downloadDelegate.DidFinish += new DidFinishEvent(downloadDelegate_DidFinish); downloadDelegate.DidFailWithError += new DidFailWithErrorEvent(downloadDelegate_DidFailWithError); // UIDelegate events uiDelegate.CreateWebViewWithRequest += new CreateWebViewWithRequestEvent(uiDelegate_CreateWebViewWithRequest); activationContext.Deactivate(); }
private void InitializeWebKit() { activationContext.Activate(); frameLoadDelegate = new WebFrameLoadDelegate(); Marshal.AddRef(Marshal.GetIUnknownForObject(frameLoadDelegate)); downloadDelegate = new WebDownloadDelegate(); Marshal.AddRef(Marshal.GetIUnknownForObject(downloadDelegate)); policyDelegate = new WebPolicyDelegate(AllowNavigation, AllowDownloads, AllowNewWindows); Marshal.AddRef(Marshal.GetIUnknownForObject(policyDelegate)); uiDelegate = new WebUIDelegate(this); Marshal.AddRef(Marshal.GetIUnknownForObject(uiDelegate)); webNotificationCenter = new WebNotificationCenter(); Marshal.AddRef(Marshal.GetIUnknownForObject(webNotificationCenter)); // TODO: find out if this is really needed webNotificationObserver = new WebNotificationObserver(); webNotificationCenter.defaultCenter().addObserver(webNotificationObserver, "WebProgressEstimateChangedNotification", webView); webNotificationCenter.defaultCenter().addObserver(webNotificationObserver, "WebProgressStartedNotification", webView); webNotificationCenter.defaultCenter().addObserver(webNotificationObserver, "WebProgressFinishedNotification", webView); webView.setPolicyDelegate(policyDelegate); webView.setFrameLoadDelegate(frameLoadDelegate); webView.setDownloadDelegate(downloadDelegate); webView.setUIDelegate(uiDelegate); webView.setHostWindow(this.host.Handle.ToInt32()); tagRECT rect = new tagRECT(); rect.top = rect.left = 0; rect.bottom = this.host.Height - 1; rect.right = this.host.Width - 1; webView.initWithFrame(rect, null, null); IWebViewPrivate webViewPrivate = (IWebViewPrivate)webView; webViewHWND = (IntPtr)webViewPrivate.viewWindow(); // Subscribe to FrameLoadDelegate events frameLoadDelegate.DidRecieveTitle += new DidRecieveTitleEvent(frameLoadDelegate_DidRecieveTitle); frameLoadDelegate.DidFinishLoadForFrame += new DidFinishLoadForFrameEvent(frameLoadDelegate_DidFinishLoadForFrame); frameLoadDelegate.DidStartProvisionalLoadForFrame += new DidStartProvisionalLoadForFrameEvent(frameLoadDelegate_DidStartProvisionalLoadForFrame); frameLoadDelegate.DidCommitLoadForFrame += new DidCommitLoadForFrameEvent(frameLoadDelegate_DidCommitLoadForFrame); frameLoadDelegate.DidFailLoadWithError += new DidFailLoadWithErrorEvent(frameLoadDelegate_DidFailLoadWithError); frameLoadDelegate.DidFailProvisionalLoadWithError += new DidFailProvisionalLoadWithErrorEvent(frameLoadDelegate_DidFailProvisionalLoadWithError); frameLoadDelegate.DidClearWindowObject += new DidClearWindowObjectEvent(frameLoadDelegate_DidClearWindowObject); // DownloadDelegate events downloadDelegate.DidReceiveResponse += new DidReceiveResponseEvent(downloadDelegate_DidReceiveResponse); downloadDelegate.DidReceiveDataOfLength += new DidReceiveDataOfLengthEvent(downloadDelegate_DidReceiveDataOfLength); downloadDelegate.DecideDestinationWithSuggestedFilename += new DecideDestinationWithSuggestedFilenameEvent(downloadDelegate_DecideDestinationWithSuggestedFilename); downloadDelegate.DidBegin += new DidBeginEvent(downloadDelegate_DidBegin); downloadDelegate.DidFinish += new DidFinishEvent(downloadDelegate_DidFinish); downloadDelegate.DidFailWithError += new DidFailWithErrorEvent(downloadDelegate_DidFailWithError); // UIDelegate events uiDelegate.CreateWebViewWithRequest += new CreateWebViewWithRequestEvent(uiDelegate_CreateWebViewWithRequest); uiDelegate.RunJavaScriptAlertPanelWithMessage += new RunJavaScriptAlertPanelWithMessageEvent(uiDelegate_RunJavaScriptAlertPanelWithMessage); uiDelegate.RunJavaScriptConfirmPanelWithMessage += new RunJavaScriptConfirmPanelWithMessageEvent(uiDelegate_RunJavaScriptConfirmPanelWithMessage); uiDelegate.RunJavaScriptTextInputPanelWithPrompt += new RunJavaScriptTextInputPanelWithPromptEvent(uiDelegate_RunJavaScriptTextInputPanelWithPrompt); // Notification events webNotificationObserver.OnNotify += new OnNotifyEvent(webNotificationObserver_OnNotify); activationContext.Deactivate(); }
private void InitializeWebKit() { activationContext.Activate(); resourceIntercepter = new ResourcesIntercepter(this); Marshal.AddRef(Marshal.GetIUnknownForObject(resourceIntercepter)); frameLoadDelegate = new WebFrameLoadDelegate(); Marshal.AddRef(Marshal.GetIUnknownForObject(frameLoadDelegate)); downloadDelegate = new WebDownloadDelegate(this); Marshal.AddRef(Marshal.GetIUnknownForObject(downloadDelegate)); uiDelegate = new WebUIDelegate(this); Marshal.AddRef(Marshal.GetIUnknownForObject(uiDelegate)); resourcesLoadDelegate = new WebResourceLoadDelegate(this); Marshal.AddRef(Marshal.GetIUnknownForObject(resourcesLoadDelegate)); //editingDelegate = new WebEditingDelegate(this); //Marshal.AddRef(Marshal.GetIUnknownForObject(editingDelegate)); // not used (yet) policyDelegate = new WebPolicyDelegate(AllowNavigation, AllowDownloads, AllowNewWindows, this); Marshal.AddRef(Marshal.GetIUnknownForObject(policyDelegate)); formDelegate = new WebFormDelegate(this); Marshal.AddRef(Marshal.GetIUnknownForObject(formDelegate)); center = new WebNotificationCenter(); Marshal.AddRef(Marshal.GetIUnknownForObject(center)); cssmanager = new WebKitDOMCSSManager(this); Marshal.AddRef(Marshal.GetIUnknownForObject(cssmanager)); undoManager = new CustomUndoSystem(this); appearance = new AppearanceSettings(this); observer = new WebNotificationObserver(); webView.setHostWindow(this.Handle.ToInt32()); ((WebViewClass)webView).setPolicyDelegate(policyDelegate); webView.setFrameLoadDelegate(frameLoadDelegate); webView.setResourceLoadDelegate(resourcesLoadDelegate); webView.setDownloadDelegate(downloadDelegate); webView.setUIDelegate(uiDelegate); tagRECT rect = new tagRECT(); rect.top = rect.left = 0; rect.bottom = this.Height - 1; rect.right = this.Width - 1; webView.initWithFrame(rect, null, null); IWebViewPrivate webViewPrivate = (IWebViewPrivate)webView; webViewHWND = (IntPtr)webViewPrivate.viewWindow(); webViewPrivate.setFormDelegate(formDelegate); // Subscribe to FrameLoadDelegate events ((WebFrameLoadDelegate)frameLoadDelegate).DidRecieveTitle += new DidRecieveTitleEvent(frameLoadDelegate_DidRecieveTitle); ((WebFrameLoadDelegate)frameLoadDelegate).DidFinishLoadForFrame += new DidFinishLoadForFrameEvent(frameLoadDelegate_DidFinishLoadForFrame); ((WebFrameLoadDelegate)frameLoadDelegate).DidStartProvisionalLoadForFrame += new DidStartProvisionalLoadForFrameEvent(frameLoadDelegate_DidStartProvisionalLoadForFrame); ((WebFrameLoadDelegate)frameLoadDelegate).DidCommitLoadForFrame += new DidCommitLoadForFrameEvent(frameLoadDelegate_DidCommitLoadForFrame); ((WebFrameLoadDelegate)frameLoadDelegate).DidFailLoadWithError += new DidFailLoadWithErrorEvent(frameLoadDelegate_DidFailLoadWithError); ((WebFrameLoadDelegate)frameLoadDelegate).DidFailProvisionalLoadWithError += new DidFailProvisionalLoadWithErrorEvent(frameLoadDelegate_DidFailProvisionalLoadWithError); #if DEBUG || RELEASE ((WebFrameLoadDelegate)frameLoadDelegate).WindowScriptObjectAvailable += new WindowScriptObjectAvailableEvent(WebKitBrowser_WindowScriptObjectAvailable); ((WebFrameLoadDelegate)frameLoadDelegate).DidClearWindowObject += new DidClearWindowObjectEvent(WebKitBrowser_DidClearWindowObject); #endif // DownloadDelegate events downloadDelegate.DecideDestinationWithSuggestedFilename += new DecideDestinationWithSuggestedFilenameEvent(downloadDelegate_DecideDestinationWithSuggestedFilename); downloadDelegate.DidBegin += new DidBeginEvent(downloadDelegate_DidBegin); // UIDelegate events uiDelegate.CreateWebViewWithRequest += new CreateWebViewWithRequestEvent(uiDelegate_CreateWebViewWithRequest); uiDelegate.CloseWindowRequest += new CloseWindowRequest(uiDelegate_CloseWindowRequest); uiDelegate.StatusTextChanged += new StatusTextChangedEvent(uiDelegate_StatusTextChanged); uiDelegate.RunJavaScriptAlertPanelWithMessage += new RunJavaScriptAlertPanelWithMessageEvent(uiDelegate_RunJavaScriptAlertPanelWithMessage); uiDelegate.RunJavaScriptConfirmPanelWithMessage += new RunJavaScriptConfirmPanelWithMessageEvent(uiDelegate_RunJavaScriptConfirmPanelWithMessage); uiDelegate.RunJavaScriptTextInputPanelWithPrompt += new RunJavaScriptTextInputPanelWithPromptEvent(uiDelegate_RunJavaScriptTextInputPanelWithPrompt); uiDelegate.RunJavaScriptPromptBeforeUnload += new RunJavaScriptPromptBeforeUnload(uiDelegate_RunJavaScriptPromptBeforeUnload); uiDelegate.MouseDidMoveOverElement += new MouseDidMoveOverElement(uiDelegate_UpdateCurrentElement); uiDelegate.GeolocationReq += new AllowGeolocationRequest(uiDelegate_GeolocationReq); // FormDelegate Events formDelegate.SubmitForm += new SubmitForm(formDelegate_SubmitForm); formDelegate.TextChangedInArea += new TextChangedInArea(formDelegate_TextChangedInArea); formDelegate.TextChangedInField += new TextChangedInField(formDelegate_TextChangedInField); formDelegate.TextFieldBeginEditing += new TextFieldBeginEditing(formDelegate_TextFieldBeginEditing); formDelegate.TextFieldEndEditing += new TextFieldEndEditing(formDelegate_TextFieldEndEditing); // ResourcesLoadDelegate resourcesLoadDelegate.PluginFailed += new PluginFailedWithError(resourcesLoadDelegate_PluginFailed); resourcesLoadDelegate.ResourceLoaded += new ResourceFinishedLoading(resourcesLoadDelegate_ResourceLoaded); resourcesLoadDelegate.ResourceLoading += new ResourceStartedLoading(resourcesLoadDelegate_ResourceLoading); resourcesLoadDelegate.ResourceSizeAvailable += new ResourceSizeAvailableEventHandler(resourcesLoadDelegate_ResourceProgress); resourcesLoadDelegate.ResourceRequestSent += new ResourceRequest(resourcesLoadDelegate_ResourceRequestSent); resourcesLoadDelegate.ResourceFailedLoading += new ResourceFailed(resourcesLoadDelegate_ResourceFailedLoading); progs = new WebNotificationObserver(); progf = new WebNotificationObserver(); policyDelegate.NewWindowRequestUrlAvailable += new WebKit.NewWindowRequest(policyDelegate_NewWindowRequestUrlAvailable); ApplicationName = GlobalPreferences.ApplicationName; center.defaultCenter().addObserver(observer, "WebProgressEstimateChangedNotification", webView); observer.OnNotify += new OnNotifyEvent(observer_OnNotify); center.defaultCenter().addObserver(progs, "WebViewProgressStartedNotification", webView); progs.OnNotify += new OnNotifyEvent(progs_OnNotify); center.defaultCenter().addObserver(progf, "WebViewProgressFinishedNotification", webView); progf.OnNotify += new OnNotifyEvent(progf_OnNotify); //WebView.preferences().setEditingBehavior(WebKitEditingBehavior.WebKitEditingWinBehavior); ((IWebPreferencesPrivate)WebView.preferences()).setDeveloperExtrasEnabled(1); #if DEBUG || RELEASE m = new JSManagement(this); #endif activationContext.Deactivate(); }
public static extern bool GetClientRect(IntPtr hWnd, out tagRECT lpRect);
public void drawHeaderInRect(WebView WebView, ref tagRECT rect, int drawingContext) { }
public void paintCustomScrollCorner(WebView WebView, ref _RemotableHandle hDC, tagRECT rect) { }
public void paintCustomScrollCorner(WebView WebView, int hDC, tagRECT rect) { }
public tagRECT webViewPrintingMarginRect(WebView WebView) { PageSettings settings = owner.PageSettings; // WebKit specifies margins in 1000ths of an inch. (???) // PrinterResolution.Y returns 0 for some reason, // on Adobe distiller anyway, so we'll use X for the moment. int dpi = settings.PrinterResolution.X; int marginLeft = settings.Margins.Left; int marginRight = settings.Margins.Right; int marginTop = settings.Margins.Top; int marginBottom = settings.Margins.Bottom; int pageWidth = settings.PaperSize.Width; int pageHeight = settings.PaperSize.Height; // TODO: find out what these are actually supposed to be // the x10 and x20 are completely arbitrary, based on // what I found fits an A4 portrait page with 1 inch // margins... tagRECT rect = new tagRECT(); rect.left = marginLeft; rect.top = marginTop; rect.right = marginRight * 10; rect.bottom = marginBottom * 20; return rect; /*rect.left = 20; rect.top = 20; rect.right = 400; rect.bottom = 400; return rect;*/ }
public void setFrame(WebView sender, ref tagRECT frame) { }
//点、线、面填充颜色变化响应事件 private void cbColor_MouseUp(object sender, MouseEventArgs e) { IRgbColor pColor = new RgbColor(); //颜色实例 pColor.RGB = 255; tagRECT pTag = new tagRECT(); //用于下面显示 ColorPalette 的位置 pTag.left = cbColor.PointToScreen(System.Drawing.Point.Empty).X; //按钮控件的左边全局横坐标 pTag.bottom = cbColor.PointToScreen(System.Drawing.Point.Empty).Y + cbColor.Height; //按钮控件的下边全局纵坐标 IColorPalette pColorPalette = new ColorPalette(); pColorPalette.TrackPopupMenu(ref pTag, pColor, false, 0); //显示 ColorPalette pColor = pColorPalette.Color as IRgbColor; //获取选中的颜色 Color color = Color.FromArgb(pColor.Red, pColor.Green, pColor.Blue); //将颜色转为 C# 颜色 btColor.BackColor = color; cbColor.BackColor = color; switch (((IFeatureLayer)pLayer).FeatureClass.ShapeType) //判断几何体样式 { case esriGeometryType.esriGeometryPoint: //点 ((IMarkerSymbol)pStyleGalleryItem.Item).Color = pColor; //转为 IMarkerSymbol,注意改好后要在图片上显示 PreviewPicture(); break; case esriGeometryType.esriGeometryPolyline: //线 ((ILineSymbol)pStyleGalleryItem.Item).Color = pColor; //转为 ILineSymbol PreviewPicture(); break; case esriGeometryType.esriGeometryPolygon: //面 ((IFillSymbol)pStyleGalleryItem.Item).Color = pColor; //转为 IFillSymbol PreviewPicture(); break; default: break; } }
//填充外边框颜色变化响应事件 private void cbOutlineColor_MouseUp(object sender, MouseEventArgs e) { IRgbColor pColor = new RgbColor(); pColor.RGB = 255; tagRECT ptagRECT = new tagRECT(); ptagRECT.left = cbOutlineColor.PointToScreen(System.Drawing.Point.Empty).X; ptagRECT.bottom = cbOutlineColor.PointToScreen(System.Drawing.Point.Empty).Y + cbOutlineColor.Height; IColorPalette pColorPalette = new ColorPalette(); pColorPalette.TrackPopupMenu(ref ptagRECT, pColor, false, 0); pColor = pColorPalette.Color as IRgbColor; Color color = Color.FromArgb(pColor.Red, pColor.Green, pColor.Blue); //btOutlineColor.BackColor = color; cbOutlineColor.BackColor = color; ILineSymbol pLineSymbol = ((IFillSymbol)pStyleGalleryItem.Item).Outline; pLineSymbol.Color = pColor; ((IFillSymbol)pStyleGalleryItem.Item).Outline = pLineSymbol; PreviewPicture(); }
/// <summary> /// nDeviceFrameUpdated event handler /// </summary> /// <param name="sender"></param> /// <param name="sizeChanged"></param> private void OnDeviceFrameUpdated(IDisplayTransformation sender, bool sizeChanged) { //update the device frame rectangle m_deviceFrame = sender.get_DeviceFrame(); }
public void drawBackground(WebView sender, int hDC, ref tagRECT dirtyRect) { }
///<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(); } }