执行 ScaleTransform.ScaleY 时不应拉伸字体
我使用以下代码动态增加按钮高度 50%。
<Style TargetType="{x:Type Button}">
<Setter Property="LayoutTransform">
<Setter.Value/>
<ScaleTransform ScaleX="1" ScaleY="1.5" CenterX=".5" CenterY=".5"/>
</Setter.Value>
</Setter>
</Style>
但我认为 LayoutTransform 也会改变字体高度。由于我只增加高度(ScaleY),因此按钮的字体看起来像是垂直拉伸的。
但我不想在进行 ScaleTransform 时增加字体大小。相反,我想手动更改字体大小,而且它不应该看起来像拉伸的。
请帮我看看该怎么做???如果我得到任何代码,这将非常有帮助。
提前致谢!
I am using the following code to increase the Button height 50% dynamically.
<Style TargetType="{x:Type Button}">
<Setter Property="LayoutTransform">
<Setter.Value/>
<ScaleTransform ScaleX="1" ScaleY="1.5" CenterX=".5" CenterY=".5"/>
</Setter.Value>
</Setter>
</Style>
But i think LayoutTransform changes the font height also. As I am only increasing the height (ScaleY), the font of the buttons looks liks stretched Vertically.
But I dont want to increase the font size when do the ScaleTransform. Instead i want to change the font size manually and also it should not look like stretched.
Please help me how to do this??? It will be really helpful if i get any code.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有看到你的 XAML,很难准确回答,但这里有一些想法......
我猜你不能因为任何原因只设置按钮高度。
那么您希望按钮高 1.5 倍,但又不想缩放其内容?如果是这种情况,您可以将其放置在容器(例如 Grid)中,然后将 LayoutTransform 应用于 Grid 吗?
或者,您可以将 LayoutTransform 应用于按钮,然后将 RenderTransform 应用于其内容,这将“取消”这 1.5 倍的缩放。
Without seeing your XAML, it is hard to answer exactly, but here are a few ideas ...
I am guessing you can't just set the Button height for whatever reason.
So you want the button to be 1.5 times higher, but you do not want to scale its contents? If this is the case, can you place it within a container, a Grid for example, then apply the LayoutTransform to the Grid?
Or, you could apply yor LayoutTransform to the button, then apply a RenderTransform to its contents that would 'cancel ou' this 1.5 times scaling.