How to Convert ILayer to IPolygon In ArcObjects

Posted by Scott on Stack Overflow See other posts from Stack Overflow or by Scott
Published on 2010-05-17T15:53:15Z Indexed on 2010/05/17 17:30 UTC
Read the original article Hit count: 324

Filed under:
|
|
|

Having trouble converting an Ilayer to an IPolygon.

I am developing a toolbar for ArcMap and I grab a layer via code from the side table of contents. The Layer is a Polygon, but the code won't convert it to a IPolygon.

Can anyone help me out? This is the code I am using to try and convert it to a IPolygon...

 IPolygon poly = m_document.Maps.get_Item(0).get_Layer(0) as IPolygon;

I can do this:

 ILayer layer = m_document.Maps.get_Item(0).get_Layer(0) as ILayer;

And that works, just not converting it to a IPloygon..

© Stack Overflow or respective owner

Related posts about arcobjects

Related posts about esri