I've got the following code, taken almost directly from the printing example:
private void Form1_Load(object sender, EventArgs e)
{
SetupMapWithBlankPage();
winformsMap1.Refresh();
}
private void SetupMapWithBlankPage()
{
// Setup the map unit, you want to always use feet or meters for printer layout maps
winformsMap1.MapUnit = GeographyUnit.Meter;
// Here we create the default zoom levels for the sample. We have pre-created a PrinterZoomLevelSet
// That pre-defines commonly used zoom levels based on percentages of zoom
winformsMap1.ZoomLevelSet = new PrinterZoomLevelSet(winformsMap1.MapUnit, PrinterHelper.GetPointsPerGeographyUnit(winformsMap1.MapUnit));
// Here we set the background color to gray so there is contrast with the while page
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.LightGray);
// Create the PrinterInteractiveOverlay to contain all of the PrinterLayers.
// The interactive overlay allows the layers to be interacted with
PrinterInteractiveOverLay printerOverlay = new PrinterInteractiveOverLay();
winformsMap1.InteractiveOverlays.Add("PrintPreviewOverlay", printerOverlay);
winformsMap1.InteractiveOverlays.MoveToBottom("PrintPreviewOverlay");
// Create the PagePrinterLayer which shows the page boundary and is the area the user will
// arrange all of the other layer on top of.
PagePrinterLayer pagePrinterLayer = new PagePrinterLayer(PrinterPageSize.Custom, PrinterOrientation.Landscape);
float pageWidth = (float)PrinterHelper.ConvertLength(24, PrintingUnit.Inch, PrintingUnit.Point);
float pageHeight = (float)PrinterHelper.ConvertLength(36, PrintingUnit.Inch, PrintingUnit.Point);
pagePrinterLayer.CustomWidth = pageWidth;
pagePrinterLayer.CustomHeight = pageHeight;
pagePrinterLayer.Open();
printerOverlay.PrinterLayers.Add("PageLayer", pagePrinterLayer);
// Get the pages extent, slightly scale it up, and then set that as the default current extent
winformsMap1.CurrentExtent = RectangleShape.ScaleUp(pagePrinterLayer.GetPosition(), 10).GetBoundingBox();
// Set the minimum scale of the map to the last zoom level
winformsMap1.MinimumScale = winformsMap1.ZoomLevelSet.ZoomLevel20.Scale;
}
But now, whenever I zoom, pan, or resize my window, the printer page flips between landscape and portrait.. Very frustrating.
Anyone seen anything like this before?
Thanx!
-Jason