c# - Avoid that a word be deselected -
i'm working in application going measure speed of typing.
i want select word writing @ moment. have fragment of code in form load event:
string line; filestream fs = new filestream("text.txt", filemode.open, fileaccess.read); streamreader fr = new streamreader(fs); while ((line = fr.readline()) != null) { textbox1.appendtext(line); } string texto = textbox1.text; string[] split = texto.split(new char[] { ' ' }); textbox1.selectionstart = 0; textbox1.selectionlength = split[0].length;
that works correctly, when change focus textbox begin type, selected word disappears.
is there way avoid happening ?
to prevent textbox losing selection when loses focus, can (when form created).
textbox1.hideselection = false;
refer textboxbase.hideselection
property:
gets or sets value indicating whether selected text in text box control remains highlighted when control loses focus.
Comments
Post a Comment