开发者

Getting highlighted text

开发者 https://www.devze.com 2023-01-24 04:34 出处:网络
I have a text box.I need to get extract the highlighte开发者_开发问答d and copy that to another text box.

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

精彩评论

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