RadSyntaxEditorElement offers the following method: public CaretPosition GetPositionFromPoint(System.Drawing.Point point)
However, it doesn't return the correct CaretPosition as it requires to transform the System.Drawing.Point first:
private void MySyntaxEditor1_MouseDown(object sender, MouseEventArgs e)
{
CaretPosition pos = mySyntaxEditor1.SyntaxEditorElement.GetPositionFromPoint(GetPosition(e, mySyntaxEditor1.SyntaxEditorElement.EditorPresenter));
CaretPosition start = new CaretPosition(pos);
start.MoveToCurrentWordStart();
CaretPosition end = new CaretPosition(pos);
end.MoveToCurrentWordEnd();
mySyntaxEditor1.SyntaxEditorElement.Selection.Select(start, end);
}
public Telerik.WinControls.SyntaxEditor.UI.Point GetPosition(System.Windows.Forms.MouseEventArgs args, Telerik.WinControls.SyntaxEditor.UI.UIElement element)
{
System.Drawing.Point screenLocation = mySyntaxEditor1.SyntaxEditorElement.PointToScreen(args.Location);
System.Drawing.Point point = element.PointFromScreen(screenLocation);
Telerik.WinControls.Layouts.RadMatrix matrix = element.TotalTransform;
matrix.Invert();
return new System.Drawing.PointF(point.X * matrix.ScaleX, point.Y * matrix.ScaleY);
}