IEnvelope pEnv = new EnvelopeClass() as IEnvelope;
pEnv.PutCoords(x1, y1, x2, y2);
m_ipGeo = (IGeometry)pEnv; ;//确定范围
m_iApp.MapControl.FullExtent = pEnv; //必须加上否则地图不能正常显示
if (null == m_ipGeo) return;
IRgbColor pColor = new RgbColorClass();
//pColor.RGB = m_corlorSelection.ToArgb();
Color cr = m_iApp.SelectionCorlor;
pColor.Blue = cr.B;
pColor.Green = cr.G;
pColor.Red = cr.R;
pColor.Transparency = cr.A;
object ob = null;
int m_iSelectionRadPixels = m_iApp.SelectionBufferInPixels;
ISymbol pSymbol = null;
switch (m_ipGeo.GeometryType)
{
case esriGeometryType.esriGeometryPolyline:
ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbol();
pSymbol = (ISymbol)pSimpleLineSymbol;
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;// = esriROPNotXOrPen;
pSimpleLineSymbol.Color = pColor;
pSimpleLineSymbol.Color.Transparency = 1;
pSimpleLineSymbol.Width = m_iSelectionRadPixels;
break;
case esriGeometryType.esriGeometryPolygon:
case esriGeometryType.esriGeometryEnvelope:
ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbol();
pSymbol = (ISymbol)pSimpleFillSymbol;
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
pSimpleFillSymbol.Color = pColor;
pSimpleFillSymbol.Color.Transparency = 1;
break;
case esriGeometryType.esriGeometryPoint:
ISimpleMarkerSymbol pSimpleMarkersymbol = new SimpleMarkerSymbol();
pSymbol = (ISymbol)pSimpleMarkersymbol;
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
pSimpleMarkersymbol.Color = pColor;
pSimpleMarkersymbol.Size = m_iSelectionRadPixels + m_iSelectionRadPixels + m_iSelectionRadPixels;
break;
}
ob = (object)pSymbol;
m_iApp.MapControl.DrawShape(m_ipGeo, ref ob);