} // getMediaPrintableArea /// <summary> /// Get Printable Media Area /// </summary> /// <param name="area">Printable Area</param> public void SetMediaPrintableArea(MediaPrintableArea area) { int inch = MediaPrintableArea.INCH; log.Fine(area.ToString(inch, "\"")); SetImageableArea(area.GetX(inch) * 72, area.GetY(inch) * 72, area.GetWidth(inch) * 72, area.GetHeight(inch) * 72); } // setMediaPrintableArea
} // toString /// <summary> /// Get Printable Media Area /// </summary> /// <returns>Printable Area</returns> public MediaPrintableArea GetMediaPrintableArea() { MediaPrintableArea area = new MediaPrintableArea((float)GetImageableX() / 72, (float)GetImageableY() / 72, (float)GetImageableWidth() / 72, (float)GetImageableHeight() / 72, MediaPrintableArea.INCH); // log.fine( "CPaper.getMediaPrintableArea", area.toString(MediaPrintableArea.INCH, "\"")); return(area); } // getMediaPrintableArea
public override bool Equals(Object ob) { bool ret = false; if (ob is MediaPrintableArea) { MediaPrintableArea mm = (MediaPrintableArea)ob; if (x == mm.x && y == mm.y && w == mm.w && h == mm.h) { ret = true; } } return(ret); }
private void printDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Graphics g2D = e.Graphics; float dpiX = e.PageSettings.PrinterResolution.X; float dpiY = e.PageSettings.PrinterResolution.Y; MediaPrintableArea area = m_layout.GetPaper().GetMediaPrintableArea(); RectangleF rcfFrame = new RectangleF(dpiX * e.MarginBounds.Left / 100.0f, dpiY * e.MarginBounds.Top / 100.0f, dpiX * e.MarginBounds.Width / 100.0f - 1, dpiY * e.MarginBounds.Height / 100.0f - 1); //if(e.Graphics.PageUnit != GraphicsUnit.Inch) //e.Graphics.PageUnit = GraphicsUnit.Pixel; //g2D.TranslateTransform(this.AutoScrollPosition.X, this.AutoScrollPosition.Y); try { //RectangleF bounds = e.PageBounds; //Rectangle bound = GetRealPageBound(e, true); SolidBrush brush = new SolidBrush(COLOR_BACKGROUND); //background color filling //for (int page = 0; page < m_layout.GetPages().Count(); page++) { Rectangle pageRectangle = GetRectangleOfPage(m_PageNum + 1); pageRectangle.Y = 5; //if (bound.IntersectsWith(pageRectangle)) { Page p = (Page)m_layout.GetPages()[m_PageNum]; p.Paint(g2D, pageRectangle, true, false); // sets context m_layout.GetHeaderFooter().Paint(g2D, pageRectangle, true); ++m_PageNum; e.HasMorePages = (m_PageNum < m_layout.GetPages().Count()); } // //e.HasMorePages = true; } //e.HasMorePages = false; //e.Graphics.DrawImageUnscaled(drawing, 0, 0); brush.Dispose(); } catch { } g2D.Dispose(); //this.AutoScrollMinSize = new System.Drawing.Size(this.GetPaperWidth(), this.GetPaperHeight() * m_layout.GetPages().Count() + (m_layout.GetPages().Count() * 5) + 10); }