public void UpdateSelectionRange() { if (startPoint.TextRun != null && !startPoint.TextRun.HasParent) { EditableTextLine startLine = startPoint.EditableLine; startPoint = startLine.GetTextPointInfoFromCharIndex(startPoint.LineCharIndex); } if (endPoint.TextRun != null && !endPoint.TextRun.HasParent) { EditableTextLine stopLine = endPoint.EditableLine; endPoint = stopLine.GetTextPointInfoFromCharIndex(endPoint.LineCharIndex); } }
public Rectangle GetRectAreaOf(int beginlineNum, int beginColumnNum, int endLineNum, int endColumnNum) { EditableTextFlowLayer flowLayer = this.textLayer; EditableTextLine beginLine = flowLayer.GetTextLineAtPos(beginlineNum); if (beginLine == null) { return(Rectangle.Empty); } if (beginlineNum == endLineNum) { VisualPointInfo beginPoint = beginLine.GetTextPointInfoFromCharIndex(beginColumnNum); VisualPointInfo endPoint = beginLine.GetTextPointInfoFromCharIndex(endColumnNum); return(new Rectangle(beginPoint.X, beginLine.Top, endPoint.X, beginLine.ActualLineHeight)); } else { VisualPointInfo beginPoint = beginLine.GetTextPointInfoFromCharIndex(beginColumnNum); EditableTextLine endLine = flowLayer.GetTextLineAtPos(endLineNum); VisualPointInfo endPoint = endLine.GetTextPointInfoFromCharIndex(endColumnNum); return(new Rectangle(beginPoint.X, beginLine.Top, endPoint.X, beginLine.ActualLineHeight)); } }