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>
效果
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。