开发者

Getting highlighted text

I have a text box. I need to get extract the highlighte开发者_开发问答d and copy that to another text box. User will highlight it after typing.

How to do it? Thanks Furqan


Use the SelectedText property (also available in XAML, if you’re using WPF instead of WinForms):

OtherTextBox.Text = FirstTextBox.SelectedText


Assuming you are talking about a System.Windows.Control, you can grab the SelectedText on the SelectionChanged event.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜