WinForm 换行问题 textbox (转)

时间:2023-03-08 21:46:26
WinForm 换行问题 textbox  (转)

WinForm 换行问题 textbox
今天碰到一段string在label中能正常换行,但是在textbox中却无法换行的问题。

首先考虑是换行符的问题。在网上查了些资料:

1、TextBox 中换行符为: "\r\n"。

2、Windows 中的换行符(即:Environment.NewLine) 为 "\r\n"

3、MessageBox.Show() 的换行符为 "\n"

4、Console 的换行符为 "\n"

5、换行符还因平台而已,Unix/Linux 平台换行符是 "\n"。

6、为保持平台的通用性,最好用 Environment.NewLine。
地址:http://08ylyuan.blog.163.com/blog/static/1263916622012112114516915/