public void DrawFoldingMark(bool expand, double x, double y) { string str = expand ? "-" : "+"; TextLayout layout = new TextLayout(str, this.FontFamily, this.FontSize, this.Brushes[this.ForegroundColor], this.FoldingWidth); layout.Draw(this.Context, x, y); }
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 DrawString(string str, double x, double y, StringAlignment align, Size layoutRect, StringColorType colorType = StringColorType.Forground) { TextAlignment TextAlign = TextAlignment.Left; switch (align) { case StringAlignment.Left: TextAlign = TextAlignment.Left; break; case StringAlignment.Center: TextAlign = TextAlignment.Center; break; case StringAlignment.Right: TextAlign = TextAlignment.Right; break; } TextLayout layout = new TextLayout(str, this.FontFamily, this.FontSize, this.Brushes[this.ForegroundColor], layoutRect.Width, TextAlign); layout.FlowDirection = this.RightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; layout.Draw(this.Context, x, y); layout.Dispose(); }