6

TextBlock と Rectangle があり、どちらも空の WPF4 ウィンドウに置かれています。TextBlock の Foreground と Rectangle の Fill は両方とも、値 #80800000 の SolidColorBrush に設定されています。

これは次のようになります。

ここに画像の説明を入力

Rectangle の色は正しい (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>
4

1 に答える 1

0

これは、ウィンドウの上部にある追加のアイコンと何か関係がありますか? このコードは私にとって予想通りです。

スクリーンショット

または、コードビハインドに追加の不透明度設定がありますか?

于 2011-07-07T04:32:53.550 に答える