// Draw a set of horizontal hatching lines at the given spacing with // the given pen. A line should be centered on the zero y coordinate. void DrawHatchLines(GraphicsTarget g, Pen pen, float spacing, RectangleF boundingRect, RenderOptions renderOpts) { double firstLine = Math.Round(boundingRect.Top / spacing) * spacing; double lastLine = (Math.Round(boundingRect.Bottom / spacing) + 0.5) * spacing; for (double y = firstLine; y <= lastLine; y += spacing) { g.DrawLine(pen, new PointF(boundingRect.Left, (float) y), new PointF(boundingRect.Right, (float) y)); } }
// Draw an underline under the text, if applicable. private void DrawUnderline(GraphicsTarget g, SymColor color, float baseline, float width, float indent) { if (underline.underlineOn && color == underline.underlineColor) { // Figure out the left and right sides of the underline. float l, r; if (fontAlign == TextSymDefAlignment.Right) l = -width; else if (fontAlign == TextSymDefAlignment.Center) l = -(width / 2F); else l = indent; r = l + width; // figure out y coordinate of line. float y = baseline + underline.underlineDistance + underline.underlineWidth / 2; // draw the line. g.DrawLine(underlinePen, new PointF(l, y), new PointF(r, y)); } }