如何在文本框winform C#中的两个空行之间选择文本 [英] How To Select Text between two empty line in textbox winform C#

查看:125
本文介绍了如何在文本框winform C#中的两个空行之间选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本框winform C#中的两个空行之间选择并获取文本或单词或段落?



这个我想要

< br $>

How To Select and get Text or word or paragraph between two empty lines in textbox winform C#?

this i want

Paragraph one
Paragraph one
Paragraph one

Paragraph two
Paragraph two
Paragraph two





如果有任何两个段落,当我点击第一段时选择第一段,但第二段没有选择。任何解决方案?



感谢您的帮助!



if any two paragraph, select paragraph one when i click paragraph one, but paragraph two not select. any solution?

Thanks For Help!

推荐答案

我认为您在评论中有足够的提示问题。



您已经知道如何使用 SelectionStart SelectionLength <来控制选择/ code>。您也可以使用它: https:// msdn。 microsoft.com/en-us/library/system.string.split%28v=vs.110%29.aspx [ ^ ]。



最后一个问题是用于行尾字符的内容。不幸的是,它们依赖于平台: http://en.wikipedia.org/wiki/Newline [ ^ ]。



因此,您需要使用此属性: https:/ /msdn.microsoft.com/en-us/library/system.environment.newline%28v=vs.110%29.aspx [ ^ ]。



现在你知道解决问题的一切。现在,轮到你了。



-SA
I think you got enough hints in the comments to the question.

You already know how to control selection with SelectionStart and SelectionLength. You also can use this: https://msdn.microsoft.com/en-us/library/system.string.split%28v=vs.110%29.aspx[^].

The final problem is what to use for end-of-line characters. Unfortunately, they are platform-dependent: http://en.wikipedia.org/wiki/Newline[^].

So, you need to use this property: https://msdn.microsoft.com/en-us/library/system.environment.newline%28v=vs.110%29.aspx[^].

Now you know everything to solve the problem. Now, it's your turn.

—SA


这篇关于如何在文本框winform C#中的两个空行之间选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆