I have just made a small sample for a customer who is trying to get the current input position from the current mouse position without 'destroying' the current selection.

If you use the InputPosition with the mouse coordinates in the constructor, the new input position will be set and the previous selection will be annulled. Therefore, we have implemented the TextCharCollection that contains all characters in a TX Text Control document.

The GetItem method returns the TextChar at the specified mouse position. The second parameter in the GetItem method indicates whether the method should return the nearest character.

Dim curPosition As TXTextControl.TextChar
curPosition = TextControl1.TextChars.GetItem(New Point(e.X, e.Y), True)