gpt4 book ai didi

c# - GroupBox 标题文本被截断

转载 作者:太空狗 更新时间:2023-10-29 18:28:46 24 4
gpt4 key购买 nike

我试图在 XAML 中创建一个包含三个 RadioButtonGroupBox。一切看起来都很好,除了我的 GroupBox header 中的 'g' 在底部被截断,如下所示:

Screenshot one

我读过其他有格式问题的帖子,并避免使用边距定位我的不同元素。不过,这似乎不是我的问题。我已经使用网格构建了所有内容(甚至在我的 GroupBox 中),但某些东西仍然切断了我的标题。任何输入将不胜感激!

这是当字体为正常而非粗体时 GroupBox 的样子:

Screenshot two

这是我的代码与 GroupBox 的部分:

<Grid Grid.Row="1">
<GroupBox Header="Current Units (English)" HorizontalAlignment="Stretch" Name="currentUnitsGroupBox" VerticalAlignment="Stretch" FontSize="12" FontWeight="Bold">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="6" />
<RowDefinition Height="*" />
<RowDefinition Height="4" />
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".22*" />
<ColumnDefinition Width=".22*" />
<ColumnDefinition Width=".22*" />
<ColumnDefinition Width=".36*" />
</Grid.ColumnDefinitions>
<RadioButton
Content="System"
HorizontalAlignment="Stretch"
Name="systemRadio"
VerticalAlignment="Center"
FontSize="12"
FontWeight="Bold"
IsChecked="True"
Grid.Column ="0"

AutomationProperties.AutomationId="CurrentUnitsSystem"/>
<RadioButton
Content="English"
FontSize="12"
FontWeight="Bold"
HorizontalAlignment="Stretch"
Name="englishRadio"
VerticalAlignment="Center"
Grid.Column="1"

AutomationProperties.AutomationId="CurrentUnitsEnglish"/>
<RadioButton
Content="Metric"
FontSize="12"
FontWeight="Bold"
HorizontalAlignment="Stretch"
Name="metricRadio"
VerticalAlignment="Center"
Grid.Column="2"

AutomationProperties.AutomationId="CurrentUnitsMetric"/>
</Grid>
</Grid>
</GroupBox>
</Grid>

最佳答案

我已经用我想到的所有东西对其进行了测试,但我无法重现它。请尝试以下操作:

<GroupBox FontSize="12" FontWeight="Bold"> 
<GroupBox.Header>
<TextBlock Height="22" Text="Current Units (English)"/> </GroupBox.Header>

因为 GroupBox 中的 Header 无论如何都是一个 TextBlock,所以我们现在自己做这些事情并稍微调整一下高度

关于c# - GroupBox 标题文本被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38666812/

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