gpt4 book ai didi

wpf - TextBlock 画笔给出不正确的颜色

转载 作者:行者123 更新时间:2023-12-04 16:12:51 26 4
gpt4 key购买 nike

我有一个 TextBlock 和一个 Rectangle,它们都位于一个空的 WPF4 窗口中。 TextBlock 的 Foreground 和 Rectangle 的 Fill 都设置为值为 #80800000 的 SolidColorBrush。

这是它的样子:

enter image description here

矩形的颜色是正确的(一个 50% 透明的栗色),但 TextBlock 给出了一个平坦的灰色。这是怎么回事?

编辑:这是 XAML:

<Window x:Class="WpfApplication1.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>
<TextBlock Foreground="#80800000" Height="100" HorizontalAlignment="Left" Margin="47,39,0,0" Text="TextBlock" VerticalAlignment="Top" Width="266" FontFamily="Arial" FontWeight="Bold" FontSize="56" />
<Rectangle Fill="#80800000" Height="100" HorizontalAlignment="Left" Margin="71,174,0,0" Stroke="{x:Null}" VerticalAlignment="Top" Width="200" />
</Grid>
</Window>

最佳答案

这与您窗口顶部的任何其他图标有关吗?
这段代码符合我的预期。

screenshot

或者您的代码后面是否有任何额外的不透明度设置?

关于wpf - TextBlock 画笔给出不正确的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6605534/

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