WPF / XAML - 文本可以自动调整大小吗?
对于固定大小的可换行文本区域,有没有办法根据文本量使字体大小尽可能大?
例如,如果您有一个 500x500 的区域,其中包含文本“Hello”,则字体大小将非常大。但是,如果您有一段文本,则字体大小会较小以适合该区域。
我看过 Viewbox,但看不出它可以与可换行文本一起使用。
任何可以执行此操作的 xaml 或代码都会有所帮助(不必是特定的控件)。
For a fixed size wrappable text area, is there any way to make the font size as large as possible based on the amount of text?
For example, if you have a 500x500 area with the text "Hello", the font size would be really big. But if you have a paragraph of text the font size would be smaller to fit into the area.
I have looked at Viewbox but can't see that it could work with wrappable text.
ANY xaml or code that could do this would help (doesn't have to be a specific control).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你所问的比听起来更复杂,但我会给你一个想法:
在后面的代码中:
尝试一下,拖动它,更改文本......
What you're asking is more complex than it sounds, but I'll give you an idea:
And in code behind:
Try it, drag it around, change the text...