簡體   English   中英

調整 WPF 中的投影大小。如圖所示

[英]adjust drop shadow size in WPF. shown in the image

在此處輸入圖像描述

我嘗試在 WPF 調整陰影效果。但我沒有找到任何答案。

你不能為你的影子設置邊距,所以你可以“隱藏”另一個簡單的

邊界在你的“真實”邊界后面。

將它們包裹在一個網格中,將它們放在同一個地方。

在該邊框上設置邊距,並在其上設置陰影效果。

<Grid>
   <Border Margin="20,20,0,0">
       <Border.Effects>
          <DropShadowEffect />
       </Border.Effects/>
   </Border>
   <Border x:Name="YourOriginalBorder"/>
</Grid>

只需要在o_w的例子中的Border中添加Background屬性來顯示陰影,或者使用其他控件作為例子,比如button。

<Grid>
    <Button Content="Button1" Width="150" Height="30">
        <Button.Effect>
            <DropShadowEffect BlurRadius="1" Color="Red" Direction="340" Opacity="10" ShadowDepth="30" RenderingBias="Quality" />
        </Button.Effect>
    </Button>
    <Button Content="Button1" Width="200" Height="40" />
</Grid>

在此處輸入圖像描述

我想發表評論,但我剛剛加入 StackOverflow,我還不能這樣做:(。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM