且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

圆形窗口阴影效果

更新时间:2023-01-05 14:59:48

您好scocia888,


您可以尝试以下代码:

 <网格和GT; 
< Border
BorderBrush =" Black"
BorderThickness =" 1,1,1,1"
CornerRadius =" 140,140,​​140,​​140">
< Border.Effect>
< DropShadowEffect />
< /Border.Effect>

< Border.Background>
< ImageBrush ImageSource =" /Photo/1.jpg" /&GT;
< /Border.Background>
< / Border>
< / Grid>

***的问候,


Cherry



I have the following window code which has a circular border within a transparent square window giving the effect of a circular window. How do I get a Circular drop shadow which is effectively an offset of the circle towards the bottom right. I have tried all sorts of dropShadow effects on the borders but unable to get a circular drop shadow.

Many thanks

<Window x:Class="UserTraining.ConfirmRestartWindow"    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       
    Title="Window1" Width="220" Search Google. Overflow
    AllowsTransparency="True"        
    ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True" WindowStyle="None" Height="220" Background="Transparent" ShowActivated="False" 
        WindowStartupLocation="CenterScreen" >
    
    <Grid >
        <Border BorderBrush="Black" BorderThickness="1,1,1,1" CornerRadius="140,140,140,140" >           
            <Border.Background>
                <ImageBrush ImageSource="Saturn.png"></ImageBrush>
            </Border.Background>           
        </Border>               
    </Grid>
</Window>

Hi scocia888,

You can try the following code:

  <Grid>
        <Border
            BorderBrush="Black"
            BorderThickness="1,1,1,1"
            CornerRadius="140,140,140,140">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>

            <Border.Background>
                <ImageBrush ImageSource="/Photo/1.jpg" />
            </Border.Background>
        </Border>
    </Grid>

Best Regards,

Cherry