/// <summary> /// 画边框 /// </summary> private void DrawBorder(Graphics g, MultiHeader multiHeader, Body body) { #region 实现... //网格边框矩阵 Rectangle mrecGridBorder; int x, y, width, height; width = body.Rectangle.Width; height = body.Rectangle.Height; if (multiHeader != null) { x = multiHeader.Rectangle.X; y = multiHeader.Rectangle.Y; height += multiHeader.Rectangle.Height; } else { x = body.Rectangle.X; y = body.Rectangle.Y; } if (this.IsSubTotalPerPage) { GoldPrinter.MultiHeader m = new MultiHeader(1, 1); height += m.RowHeight; m = null; } mrecGridBorder = new Rectangle(x, y, width, height); Pen pen = new Pen(Color.Black, 1); GoldPrinter.DrawRectangle dr = new DrawRectangle(); dr.Graphics = g; dr.Rectangle = mrecGridBorder; dr.Pen = pen; switch (GridBorder) { case GridBorderFlag.Single: dr.Draw(); break; case GridBorderFlag.SingleBold: dr.Pen.Width = 2; dr.Draw(); if (multiHeader != null) { dr.Rectangle = body.Rectangle; dr.DrawTopLine(); } break; case GridBorderFlag.Double: dr.Draw(); mrecGridBorder = new Rectangle(x - 2, y - 2, width + 4, height + 4); dr.Rectangle = mrecGridBorder; dr.Draw(); break; case GridBorderFlag.DoubleBold: dr.Draw(); mrecGridBorder = new Rectangle(x - 2, y - 2, width + 4, height + 4); dr.Rectangle = mrecGridBorder; dr.Pen.Width = 2; dr.Draw(); break; } #endregion }
private void DrawBorder(Graphics g,MultiHeader multiHeader,Body body) { //����߿���� RectangleF mrecGridBorder; float x,y,width,height; width = body.RectangleF.Width; height = body.RectangleF.Height; if (multiHeader != null) { x = multiHeader.RectangleF.X; y = multiHeader.RectangleF.Y; height += multiHeader.RectangleF.Height; } else { x = body.RectangleF.X; y = body.RectangleF.Y; } if (this.IsSubTotalPerPage) { DayReport.MultiHeader m = new MultiHeader(1, 1); height += m.RowHeight; m = null; } mrecGridBorder = new RectangleF(x,y,width,height); Pen pen = new Pen(Color.Black,1); GoldPrinter.DrawRectangle dr = new DrawRectangle(); dr.Graphics = g; dr.RectangleF = mrecGridBorder; dr.Pen = pen; switch (GridBorder) { case GridBorderFlag.Single: dr.Draw(); break; case GridBorderFlag.SingleBold: dr.Pen.Width = 2; dr.Draw(); if (multiHeader != null) { dr.RectangleF = body.RectangleF; dr.DrawTopLine(); } break; case GridBorderFlag.Double: dr.Draw(); mrecGridBorder = new RectangleF(x-2,y-2,width+4,height+4); dr.RectangleF = mrecGridBorder; dr.Draw(); break; case GridBorderFlag.DoubleBold: dr.Draw(); mrecGridBorder = new RectangleF(x-2,y-2,width+4,height+4); dr.RectangleF = mrecGridBorder; dr.Pen.Width = 2; dr.Draw(); break; } }