c# - Find text under caret position -
i find caret position in application need know text (word) there @ current caret position.
how can text?
if using winforms application, , caret position mean caret position in textbox. thing this.
private void textbox1_keyup(object sender, eventargs e) { getwordfromcaretposition(textbox1.text, textbox1.selectionstart); } private void textbox1_mouseup(object sender, eventargs e) { getwordfromcaretposition(textbox1.text, textbox1.selectionstart); } private string getwordfromcaretposition(string input, int position) { string word = string.empty; //yet implemented. return word; }
textbox1.caretindex
textbox1.selectionstart
. see thread if app windows phone app: selecting tapped-on word on single click in textbox
Comments
Post a Comment