WPF:TextBlock 和 Label文字垂直顯示

簡述

  製做曲線時,Y軸標籤須要垂直顯示。只需將TextBlock 或 Label 的Layout旋轉90°或270°便可。ide

代碼

<TextBlock x:Name="TbYAxis" Canvas.Left="10" Canvas.Top="50" FontSize="20" Foreground="White" Text="Y軸">
                <TextBlock.LayoutTransform>
                    <RotateTransform Angle="270"></RotateTransform>
                </TextBlock.LayoutTransform>
            </TextBlock>

            <Label x:Name="LbYAxis" Canvas.Left="50" Canvas.Top="50" FontSize="20" Foreground="White" Content="Y軸" Padding="0">
                <Label.LayoutTransform>
                    <RotateTransform Angle="90"></RotateTransform>
                </Label.LayoutTransform>
            </Label>

效果

WPF:TextBlock 和 Label文字垂直顯示

相關文章
相關標籤/搜索