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)); } }