Solved! Go to Solution.
IMapFramePtr pMapFrame = NULL; IElementPtr pElement = NULL; IGeometryPtr pMapFrameGeometry = NULL; IEnvelopePtr pMapFrameEnvelope = NULL; HRESULT hr = S_OK; double dXMin = 0.0; double dYMin = 0.0; double dXMax = 0.0; double dYMax = 0.0; // QI to get the IElement interface pElement = pMapFrame; // Obtain the extent of the MapFrame geometry hr = pElement->get_Geometry(&pMapFrameGeometry); hr = pMapFrameGeometry->get_Envelope(&pMapFrameEnvelope); // Note that the min/max X,Y values are in page units (such as inches, cm, etc.) hr = pMapFrameEnvelope->QueryCoords(&dXMin, &dYMin, &dXMax, &dYMax);
IGraphicsContainerPtr pGraphicsContainer = NULL; IElementPtr pElement = NULL; IMapFramePtr pMapFrame = NULL; // Iterate across all the elements in the PageLayoutControl graphics container pGraphicsContainer = m_pPageLayoutControl->GetGraphicsContainer(); ASSERT(pGraphicsContainer != NULL); if (pGraphicsContainer != NULL) { hr = pGraphicsContainer->Reset(); hr = pGraphicsContainer->Next(&pElement); // Examine the next page element, only being interested in MapFrame elements for this method while (pElement != NULL) { // QI to determine if this graphic element is the MapFrame pMapFrame = pElement; if (pMapFrame != NULL) { // ... processing for the MapFrame element } hr = pGraphicsContainer->Next(&pElement); }