在WPF TextBlock中的文本拉伸 [英] Text stretch in WPF TextBlock

查看:492
本文介绍了在WPF TextBlock中的文本拉伸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WPF文本块中扩展文本,而不改变文本块的字体大小? 使用布局

或渲染变换,以X或Y方向缩放您的文本,具体取决于您想要的内容。

LayoutTransform导致缩放在布局传递之前应用,这意味着元素是呈现与规模的大小考虑到。而RenderTransform在布局传递之后应用缩放,所以元素以正常大小间隔,然后应用比例。



类似于

 < TextBlock Text =Foo> 
< TextBlock.RenderTransform>
< ScaleTransform ScaleX =2ScaleY =2/>
< /TextBlock.RenderTransform>
< / TextBlock>


I want to stretch the text in WPF Textblock with out changing the font size of the textblock?

解决方案

use a layout or render transform to scale your text in the X or Y direction depending on what you want

LayoutTransform causes the scale to be applied prior to the layout pass which means the element is rendered with the scaled size taken in to account. Whereas the RenderTransform applies the scaling after the layout pass so the element is spaced at normal size then the scale is applied.

Something like

<TextBlock Text="Foo">
  <TextBlock.RenderTransform>
    <ScaleTransform ScaleX="2" ScaleY="2" />
  </TextBlock.RenderTransform>
</TextBlock>

这篇关于在WPF TextBlock中的文本拉伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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