gpt4 book ai didi

c# - ScaleTransform 有什么用?

转载 作者:行者123 更新时间:2023-11-30 14:16:54 25 4
gpt4 key购买 nike

为什么我应该使用 ScaleX="2"来代替控件宽度的两倍??

<Button Width = "100" Content="Button1"/>


<Button Width = "50" Content="Button2">
<Button.RenderTransform>
<ScaleTransform ScaleX="2" />
</Button.RenderTransform>
</Button>

两个按钮看起来完全一样,那么又是什么比例适合

最佳答案

你的“一模一样”的概念好像和我的不一样。

Screenshot

您使用 WidthHeight 指定的大小会影响控件在布局中占用的空间大小,这意味着控件可能占用更多或更少的空间,但例如,字体大小将保持不变。 RenderTransform是在此之上的操作,它不再涉及布局,因此可能会扭曲控件。

A render transform does not regenerate layout size or render size information. Render transforms are typically intended for animating or applying a temporary effect to an element. For example, the element might zoom when focused or moused over, or might jitter on load to draw the eye to that part of the user interface (UI).


另见 LayoutTransform属性,它确实会影响布局但仍会扭曲控件。

关于c# - ScaleTransform 有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6701443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com