/// <summary> /// The main entry point for the application. /// </summary> private void LoadDocumentToPageLayout() { for (int i = m_PageLayoutControl.ActiveView.FocusMap.LayerCount - 1; i >= 0; i--) { axPageLayoutControl1.ActiveView.FocusMap.AddLayer(m_PageLayoutControl.ActiveView.FocusMap.get_Layer(i)); } //Update page display cboPageSize.SelectedIndex = (int)axPageLayoutControl1.Page.FormID; cboPageToPrinterMapping.SelectedIndex = (int)axPageLayoutControl1.Page.PageToPrinterMapping; if (axPageLayoutControl1.Page.Orientation == 1) { optPortrait.Checked = true; } else { optLandscape.Checked = true; } //Zoom to whole page axPageLayoutControl1.ZoomToWholePage(); //Update printer page display UpdatePrintPageDisplay(); }
private void cmdZoomPage_Click(object sender, System.EventArgs e) { //Zoom to the whole page axPageLayoutControl1.ZoomToWholePage(); //Get the IElement interface by finding an element by its name IElement element = m_PageLayoutControl.FindElementByName("ZoomExtent", 1); if (element != null) { //Delete the element m_PageLayoutControl.GraphicsContainer.DeleteElement(element); //Refresh the graphics m_PageLayoutControl.Refresh(esriViewDrawPhase.esriViewGraphics,Type.Missing, Type.Missing); } }
private void cmdLoadMxFile_Click(object sender, System.EventArgs e) { //Open a file dialog for selecting map documents openFileDialog1.Title = "Browse Map Document"; openFileDialog1.Filter = "Map Documents (*.mxd)|*.mxd"; openFileDialog1.ShowDialog(); //Exit if no map document is selected string sFilePath = openFileDialog1.FileName; if (sFilePath == "") { return; } //Validate and load the Mx document if (axPageLayoutControl1.CheckMxFile(sFilePath) == true) { axPageLayoutControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass; axPageLayoutControl1.LoadMxFile(sFilePath, ""); axPageLayoutControl1.MousePointer = esriControlsMousePointer.esriPointerDefault; txbMxFilePath.Text = sFilePath; } else { MessageBox.Show(sFilePath + " is not a valid ArcMap document"); } //Update page display cboPageSize.SelectedIndex = (int)axPageLayoutControl1.Page.FormID; cboPageToPrinterMapping.SelectedIndex = (int)axPageLayoutControl1.Page.PageToPrinterMapping; if (axPageLayoutControl1.Page.Orientation == 1) { optPortrait.Checked = true; } else { optLandscape.Checked = true; } //Zoom to whole page axPageLayoutControl1.ZoomToWholePage(); //Update printer page display UpdatePrintPageDisplay(); }
private void cmdZoomPage_Click(object sender, System.EventArgs e) { //Zoom to the whole page axPageLayoutControl1.ZoomToWholePage(); }