public void Init(float pageWidth, float pageHeight, float scale, Control control, MonitorInfo monitorInfo) { permmWidth = monitorInfo.permmWidth; permmHeight = monitorInfo.permmHeight; this.control = control; orgPageWidth = pageWidth; orgPageHeight = pageHeight; this.pageHeight = orgPageHeight * scale; this.pageWidth = orgPageWidth * scale; this.scale = scale; printMode = PrintDrawMode.SCREEN_MODE; }
public void SetPrintMode(PrintDrawMode mode, RectangleF realMarginBounds) { printMode = mode; switch (printMode) { case PrintDrawMode.SCREEN_MODE: pageWidth = orgPageWidth * scale; pageHeight = orgPageHeight * scale; widthScale = permmWidth; heightScale = permmHeight; if (realMarginBounds != RectangleF.Empty) { offsetX = realMarginBounds.X; offsetY = realMarginBounds.Y; } else { offsetX = ((control.Width / permmWidth) / 2 - pageWidth / 2) * permmWidth; offsetY = ((control.Height / permmHeight) / 2 - pageHeight / 2) * permmHeight; } break; case PrintDrawMode.IMGEXPROT_MODE: pageWidth = orgPageWidth * scale; pageHeight = orgPageHeight * scale; widthScale = permmWidth; heightScale = permmHeight; if (realMarginBounds != RectangleF.Empty) { offsetX = realMarginBounds.X; offsetY = realMarginBounds.Y; } else { offsetX = 0; offsetY = 0; } break; case PrintDrawMode.PRINTER_MODE: scale = 1.0f; pageWidth = orgPageWidth * scale; pageHeight = orgPageHeight * scale; widthScale = 1.0f; heightScale = 1.0f; if (realMarginBounds != RectangleF.Empty) { offsetX = realMarginBounds.X; offsetY = realMarginBounds.Y; } else { offsetX = 0; offsetY = 0; } break; } }