本文整理汇总了C#中EnvelopeClass.QueryCoords方法的典型用法代码示例。如果您正苦于以下问题:C# EnvelopeClass.QueryCoords方法的具体用法?C# EnvelopeClass.QueryCoords怎么用?C# EnvelopeClass.QueryCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnvelopeClass
的用法示例。
在下文中一共展示了EnvelopeClass.QueryCoords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: get_TipText
/// <summary>
/// Map tip text at the specified mouse location.
/// </summary>
/// <param name="X"></param>
/// <param name="Y"></param>
/// <param name="Tolerance"></param>
/// <returns></returns>
public override string get_TipText(double X, double Y, double Tolerance)
{
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(X - Tolerance, Y - Tolerance,X + Tolerance, Y + Tolerance);
//reproject the envelope to the datasource doordinate system
if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode)
{
envelope.SpatialReference = m_spatialRef;
envelope.Project(m_mapSpatialRef);
}
double xmin, ymin, xmax, ymax;
envelope.QueryCoords(out xmin, out ymin, out xmax, out ymax);
//select all the records within the given extent
string qry = "LON >= " + xmin.ToString() + " AND LON <= " + xmax.ToString() + " AND Lat >= " + ymin.ToString() + " AND LAT <= " + ymax.ToString();
DataRow[] rows = m_table.Select(qry);
if(0 == rows.Length)
return string.Empty;
DataRow r = rows[0];
string zipCode = Convert.ToString(r[1]);
string cityName = Convert.ToString(r[2]);
string temperature = Convert.ToString(r[5]);
return cityName + ", " + zipCode + ", " + temperature + "F";
}
示例2: document_PrintPage
private void document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
//this code will be called when the PrintPreviewDialog.Show method is called
//set the PageToPrinterMapping property of the Page. This specifies how the page
//is mapped onto the printer page. By default the page will be tiled
//get the selected mapping option
string sPageToPrinterMapping = (string)this.comboBox1.SelectedItem;
if (sPageToPrinterMapping == null)
//if no selection has been made the default is tiling
axPageLayoutControl1.Page.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingTile;
else if (sPageToPrinterMapping.Equals("esriPageMappingTile"))
axPageLayoutControl1.Page.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingTile;
else if (sPageToPrinterMapping.Equals("esriPageMappingCrop"))
axPageLayoutControl1.Page.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingCrop;
else if (sPageToPrinterMapping.Equals("esriPageMappingScale"))
axPageLayoutControl1.Page.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingScale;
else
axPageLayoutControl1.Page.PageToPrinterMapping = esriPageToPrinterMapping.esriPageMappingTile;
//get the resolution of the graphics device used by the print preview (including the graphics device)
short dpi = (short)e.Graphics.DpiX;
//envelope for the device boundaries
IEnvelope devBounds = new EnvelopeClass();
//get page
IPage page = axPageLayoutControl1.Page;
//the number of printer pages the page will be printed on
short printPageCount;
printPageCount = axPageLayoutControl1.get_PrinterPageCount(0);
m_CurrentPrintPage++;
//the currently selected printer
IPrinter printer = axPageLayoutControl1.Printer;
//get the device bounds of the currently selected printer
page.GetDeviceBounds(printer, m_CurrentPrintPage, 0, dpi, devBounds);
//structure for the device boundaries
tagRECT deviceRect;
//Returns the coordinates of lower, left and upper, right corners
double xmin, ymin, xmax, ymax;
devBounds.QueryCoords(out xmin, out ymin, out xmax, out ymax);
//initialize the structure for the device boundaries
deviceRect.bottom = (int)ymax;
deviceRect.left = (int)xmin;
deviceRect.top = (int)ymin;
deviceRect.right = (int)xmax;
//determine the visible bounds of the currently printed page
IEnvelope visBounds = new EnvelopeClass();
page.GetPageBounds(printer, m_CurrentPrintPage, 0, visBounds);
//get a handle to the graphics device that the print preview will be drawn to
IntPtr hdc = e.Graphics.GetHdc();
//print the page to the graphics device using the specified boundaries
axPageLayoutControl1.ActiveView.Output(hdc.ToInt32(), dpi, ref deviceRect, visBounds, m_TrackCancel);
//release the graphics device handle
e.Graphics.ReleaseHdc(hdc);
//check if further pages have to be printed
if (m_CurrentPrintPage < printPageCount)
e.HasMorePages = true; //document_PrintPage event will be called again
else
e.HasMorePages = false;
}