/// <summary> /// Paints the text decoration /// </summary> /// <param name="g"></param> /// <param name="rectangle"> </param> /// <param name="isFirst"> </param> /// <param name="isLast"> </param> private void PaintDecoration(Graphics g, RectangleF rectangle, bool isFirst, bool isLast) { if (string.IsNullOrEmpty(TextDecoration) || TextDecoration == CssConstants.None || IsImage) { return; } float desc = CssUtils.GetDescent(ActualFont); float asc = CssUtils.GetAscent(ActualFont); float y = 0f; if (TextDecoration == CssConstants.Underline) { y = rectangle.Bottom - desc + 0.6f; } else if (TextDecoration == CssConstants.LineThrough) { y = rectangle.Bottom - desc - asc / 2; } else if (TextDecoration == CssConstants.Overline) { y = rectangle.Bottom - desc - asc - 2; } y -= ActualPaddingBottom - ActualBorderBottomWidth; float x1 = rectangle.X; float x2 = rectangle.Right; if (isFirst) { x1 += ActualPaddingLeft + ActualBorderLeftWidth; } if (isLast) { x2 -= ActualPaddingRight + ActualBorderRightWidth; x2 -= ActualWordSpacing + 0.8f * CssUtils.GetWordEndWhitespace(ActualFont); } g.DrawLine(new Pen(ActualColor), x1, y, x2, y); }