I want to capture the complete word at a given point (for example, cursor position), but GetWord give me the total text on the horizontal line. Whats the problem?
Let you want to capture the text at a given position, for example, the mouse cursor position. Let the line text is ” Many people use Google to search things. Google is a great searching engine.” If you put the mouse cursor on the ‘o’ of the second Google, GetWord will return: 1. the total string: Many people use Google to search things. Google is a great searching engine. 2. the cursor position: 42 In our demo program (You can find it at http://www.textcapture.com), you will find the two items as ‘All Text’ and ‘Cursor Pos’ respectively. ‘Cursor Text’ is calculated according to the total string and the cursor position. Generally, if you want to capture the complete word or phrase at a given point, you need a dictionary which contains the words or phrases you want to recognize. When you get the total string and the point position in the string, you can look up the dictionary to determine what should be returned. For some simple cases, you can use regular expression instead of a dictiona
Related Questions
- I want to capture the complete word at a given point (for example, cursor position), but GetWord give me the total text on the horizontal line. Whats the problem?
- Does GetWord support capturing text at a given position? How can I retrieve the position of the mouse cursor and the caret position?
- How do I programmatically position the cursor on a given line and character in a RichTextBox?