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 cmdPrint_Click(object sender, System.EventArgs e) { if (axPageLayoutControl1.Printer != null) { //Set mouse pointer axPageLayoutControl1.MousePointer = esriControlsMousePointer.esriPointerHourglass; //Get IPrinter interface through the PageLayoutControl's printer IPrinter printer = axPageLayoutControl1.Printer; //Determine whether printer paper's orientation needs changing if (printer.Paper.Orientation != axPageLayoutControl1.Page.Orientation) { printer.Paper.Orientation = axPageLayoutControl1.Page.Orientation; //Update the display UpdatePrintingDisplay(); } //Print the page range with the specified overlap axPageLayoutControl1.PrintPageLayout(Convert.ToInt16(txbSt