public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y) { TextLayout layout = (TextLayout)lti.GetLayout(row); if (lti.GetLengthFromLineNumber(row) == 0) { return; } if (this.Printing == false) { int lineIndex = lti.GetIndexFromLineNumber(row); int lineLength = lti.GetLengthFromLineNumber(row); var SelectRanges = from s in doc.Selections.Get(lineIndex, lineLength) let n = Util.ConvertAbsIndexToRelIndex(s, lineIndex, lineLength) select n; foreach (Selection sel in SelectRanges) { if (sel.length == 0 || sel.start == -1) { continue; } foreach (TextBounds bound in layout.GetTextBounds(sel.start, sel.length)) { Rect rect = new Rect(x, y, bound.Rectangle.Width, bound.Rectangle.Height); this.Context.DrawRectangle(this.Brushes[this.Hilight], null, rect); } } } layout.Draw(this.Context, x, y); }
public void DrawOneLine(Document doc, LineToIndexTable lti, int row, double x, double y) { PrintableTextLayout layout = (PrintableTextLayout)lti.GetLayout(row); layout.Draw(g, x, y, this.Foreground); }