How do you remove the dotted line?

987
3
03-08-2013 09:02 AM
JoeMcCollum
New Contributor
Is there a way to get rid of the dotted line?  I'm trying to get a landscape layout but there's that leftover portrait dotted line.

I don't know what it's called.  Apparently, it's not the MapFrame.  See dotline.jpg below.

Dim doc As IDocument = New MxDocument

        Dim pMxDocument As IMxDocument = doc
        m_application = doc.Parent
        m_application.Visible = True
        m_appHWnd = m_application.hWnd

        pMxDocument.ActiveView = pMxDocument.PageLayout
        pMxDocument.PageLayout.Page.Orientation = 2

        Dim GC As IGraphicsContainer = TryCast(pMxDocument.PageLayout, IGraphicsContainer)
        Dim pElement As IElement = GC.FindFrame(pMxDocument.FocusMap)
        Dim pMapFrame As IMapFrame = GC.FindFrame(pMxDocument.FocusMap)

        pMapFrame.RemoveAllLocatorRectangles()

        GC.DeleteElement(pMapFrame)
        GC.DeleteAllElements()

        Dim pEnvelope As IEnvelope = New Envelope
        pEnvelope.PutCoords(1, 1, 10, 7.5)

        pElement.Geometry = pEnvelope
        GC.AddElement(pElement, 0)

        pMxDocument.UpdateContents()
        pMxDocument.ActiveView.Refresh()
0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
What you are referring to are the printer margins.  They should update automatically but since your code is automating ArcMap instead of running inside of it then some things may not work properly.  ArcMap was never written to be automated so you might want to reconsider doing that if this problem persists.  You can turn the print margins off via IPage:IsPrintableAreaVisible.  Just set the property to False.  Turning it off and then back on might cause it to update but I don't know for sure.
0 Kudos
AlexanderGray
Occasional Contributor III
I am not 100% sure but think the dotted line is the printable area (your screen shot does not include the rulers or the snap grid) I don't have time to test today but have you looked at the orientation of the paper?
IpageLayout3.Printer.Paper.Orientation
0 Kudos
JoeMcCollum
New Contributor
A workaround I found was:

Dim pPage As IPage
pPage = pMxDocument.PageLayout.Page
pPage.PutCustomSize(11, 8.5)
0 Kudos