gpt4 book ai didi

c# - TabControl 项目标题文本在旋转选项卡后显得模糊

转载 作者:太空宇宙 更新时间:2023-11-03 17:10:30 26 4
gpt4 key购买 nike

我需要创建一个选项卡向左旋转的 WPF TabControl 控件。

我在网上找到的资源表明,这可以通过将以下两项应用于 TabControl 来完成:

<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="270"/>
</Setter.Value>
</Setter>

<TabControl TabStripPlacement="Left" ...


所有这一切都有效,选项卡按要求显示,但由于某种原因,选项卡中的标题文本在旋转后显得模糊,请说明为什么会发生这种情况,如果有什么我可以做的来解决这个问题。

完整的 XAML:

<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TabControl BorderBrush="Gray" BorderThickness="1" TabStripPlacement="Left">
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="270"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid>
<Border Name="Border" BorderBrush="Gray" BorderThickness="1" CornerRadius="6,6,0,0">
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center" HorizontalAlignment="Center"
ContentSource="Header" Margin="12,2,12,2"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.ItemContainerStyle>
<TabItem Header="Item 1" />
<TabItem Header="Item 2" />
<TabItem Header="Item 3" />
</TabControl>
</Grid>
</Window>

enter image description here

最佳答案

将以下属性添加到窗口声明 XAML

TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
UseLayoutRounding="true"

关于c# - TabControl 项目标题文本在旋转选项卡后显得模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12597474/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com