有关编辑控件的问题 [英] A question about the edit control
本文介绍了有关编辑控件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现一个函数,当Edit控件获得焦点后,将光标自动设置为字符串的起始位置.
我需要帮助,谢谢!
I want to Real a Function that When the Edit control get the focus then auto set the cursor to the starting location of the string.
I need help,Thank you !
推荐答案
在大多数情况下(请参阅我对问题的评论;您未指定使用的内容;因此答案可能有所不同),您需要将SelectionStart
和SelectionLength
设置为零;使用WPF时,将CaretIndex
设置为零;处理您的编辑控件的焦点事件.
—SA
In most cases (please see my comment to the question; you did not specify what are you using; so the answers may vary), you need to setSelectionStart
andSelectionLength
to zero; with WPF, setCaretIndex
to zero; handle the focusing event of your edit control.
—SA
这篇关于有关编辑控件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文