1

画像で十分に鮮明であることを願っています。シャドウ効果のある三角形があり、見栄えが悪く、何らかの形で壊れているようです。どんな助けでも大歓迎です。

更新:長方形とパスを分離する必要があります)

代替テキスト

XAML:

    <Grid Height="50" Width="60" >
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Rectangle Grid.Column="1" Stroke="Black" Fill="White">
            <Rectangle.Effect>
                <DropShadowEffect Opacity="0.5" ShadowDepth="4" BlurRadius="10" />
            </Rectangle.Effect>
        </Rectangle>
        <Path Fill="White" Stretch="Fill" Stroke="Black" HorizontalAlignment="Left" Margin="0,15,-1,15"
                        Data="M44.386378,164.8791 L22.983157,171.42119 44.713478,176.58567" Width="23.167">
            <Path.Effect>
                <DropShadowEffect BlurRadius="10" Opacity="0.5" ShadowDepth="4" />
            </Path.Effect>
        </Path>
    </Grid>
</Grid>
4

2 に答える 2

2

あなたの三角形で:

  1. 余白を取り除く
  2. パスの高さを明示的に設定します(「22」は、そこにあるものにかなり近いです)。

これにより、三角形の影が切り取られるのを防ぐことができます。

そのための xaml は次のとおりです。

    <Grid Height="50" Width="60" >
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="20" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Rectangle Grid.Column="1" Stroke="Black" Fill="White" >
        <Rectangle.Effect>
            <DropShadowEffect Opacity="0.5" ShadowDepth="4" BlurRadius="10" />
        </Rectangle.Effect>
    </Rectangle>
    <Path Fill="White" Stretch="Fill" Stroke="Black" HorizontalAlignment="Left" 
        Data="M44.386378,164.8791 L22.983157,171.42119 44.713478,176.58567" Width="23.167" Height="22">
        <Path.Effect>
            <DropShadowEffect BlurRadius="10" Opacity="0.5" ShadowDepth="4" />
        </Path.Effect>
    </Path>
</Grid>

于 2010-12-23T19:34:37.157 に答える
2

問題は、それぞれドロップ シャドウを持つ 2 つの別個の要素があることです。それらの影がうまく結合することは期待できません。「ぼかし」は各要素に個別に適用されます。長方形と三角形を 1 つのパスに結合してみてください。例えば

<Path Fill="White" Stretch="Fill" Stroke="Black" HorizontalAlignment="Left" Margin="0,15,-1,15"
        Data="M 0,0 L 100,0 L 100,400 L 0,400 L 0,300 L -50, 200 L 0, 100 L 0,0">
    <Path.Effect>
      <DropShadowEffect BlurRadius="10" Opacity="0.5" ShadowDepth="4" />
    </Path.Effect>
</Path>
于 2010-12-23T14:08:32.097 に答える