开发者

WPF Measure Text inside TextBlock

I have a textblock that contains some text but the text is always going to vary length and I need to render a bitmap out of this 开发者_如何学运维textblock. The problem is the textblock doesn't have a height, width, actual height, actual width, or desired size since I set the height and width to Double.NaN so the textblock would auto size. This causes me a problem because when I go to measure and arrange the text block I have no values. So is there a way for me to get a height and width measurement based on the text inside the textblock?


Does this answer your question?

http://blogs.microsoft.co.il/blogs/tamir/archive/2007/03/12/Text-length-measurement_3F00_-It_2700_s-really-easy-with-WPF.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜