如何在WPF中垂直顯示按鈕內容?

[英]How to make the button content display vertically in WPF?


Recently I installed Visual Studio 2010 and I find that the content of the sidebar button goes vertically like the below image

最近我安裝了Visual Studio 2010,我發現側邊欄按鈕的內容像下圖一樣垂直

Screenshot of vertical text for VS2010

My question is: is there a simple way to achieve this effect in WPF?

我的問題是:有沒有一種簡單的方法可以在WPF中實現這種效果?

2 个解决方案

#1


15  

Very easy, use LayoutTransform and RotateTransform:

非常簡單,使用LayoutTransform和RotateTransform:

<ToggleButton Content="Members Info" HorizontalAlignment="Right" 
              Click="btn_MembersInfo_Click">         
    <ToggleButton.LayoutTransform>
        <RotateTransform Angle="-90" />
</ToggleButton.LayoutTransform>
</ToggleButton>

#2


4  

Will need to adjust Width Height and Center

將需要調整寬度高度和中心

<Button Content="RotatedButton" Width="200" Height="100">
    <Button.RenderTransform>
        <RotateTransform CenterX="0" CenterY="0" Angle="90" />
    </Button.RenderTransform>
</Button>

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/04/03/93d76735e8893b9ce554392b027c9880.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com