WPF中textbox控件怎么设置初始的多行文本

WPF中textbox控件怎么设置初始的多行文本,第1张

在添加文本框的时候,文本框右上角有一个三角,点开,会出现MUltiLine,点下那个小框框 ,会出现一个勾。这样就可以显示多行了 或者在文本框 属性上 MUltiLine 设置为True

9600的限制是为了不占用所有的CPU时间。

由 Microsoft 在 2012/4/11 於 16:03 公布

Text is displayed by one of two internal classes: SimpleTextLine and FullTextLine. The former is faster but less general - it's used for most text unless special formatting features are required.

The 9600-character limit exists to defend against very long lines taking all the CPU time. In 4.0 it applied only to FullTextLine in 4.5 it applies to both classes. You can see the same effect in 4.0 by doing anything that causes the text to use FullTextLine - for example, set FlowDirection="RightToLeft".

We need to keep the limit in effect for SimpleTextLine - the reasons we did that trump any compatibility concerns. Your behavior is a consequence. (You could argue that TextBlock/Box should only draw the first line when TextWrapping=NoWrap and the line is split because of the limit, but that would be a more significant behavior change that we won't address in 4.5.)

- WPF team

参见:https://connect.microsoft.com/VisualStudio/feedback/details/735541/wpf-textbox-and-textblock-will-show-text-wrap-when-text-is-more-than-9600


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11886644.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存