即使应用RotateTransform,Textblock也会占用相同的水平空间

问题描述

| 我将RotateTransform应用于文本块,以便它垂直显示文本,而不是水平显示文本,但是在不转换时,它在水平方向上占据相同的空间。请提出解决方案,以消除这种水平的树皮。
<Border  BorderBrush=\"#888888\" BorderThickness=\"0,2,0\">
    <TextBlock FontFamily=\"Arial\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\" FontWeight=\"Bold\" FontSize=\"15\" Text=\"Menu\" >
        <TextBlock.RenderTransform>
            <RotateTransform Angle=\"270\" />
        </TextBlock.RenderTransform>
     </TextBlock>
</Border>
    

解决方法

使用LayoutTranform而不是RenderTransform
<Border  BorderBrush=\"#888888\" BorderThickness=\"0,2,0\">
    <TextBlock FontFamily=\"Arial\" VerticalAlignment=\"Center\" HorizontalAlignment=\"Center\" FontWeight=\"Bold\" FontSize=\"15\" Text=\"Menu\" >
        <TextBlock.LayoutTransform>
            <RotateTransform Angle=\"270\" />
        </TextBlock.LayoutTransform>
     </TextBlock>
</Border>
    

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...