WPF:TextBlock 和 Label文字垂直顯示

簡述

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

代碼

<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文字垂直顯示

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章