WPF创建一个凹凸效果的边框

样式如下:

<Style x:Key="BorderStyle" TargetType="Border">
            <Setter Property="BorderBrush" Value="#55020403" />
            <Setter Property="BorderThickness" Value="2" />
            <Setter Property="CornerRadius" Value="5" />
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect
                        BlurRadius="2"
                        Opacity="0.3"
                        ShadowDepth="2"
                        Color="White" />
                </Setter.Value>
            </Setter>
        </Style>

 xmal代码如下:

<Border
            Grid.Column="1"
            Width="200"
            Height="100"
            Style="{StaticResource BorderStyle}">
            <TextBlock
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                FontSize="36"
                Foreground="#FF45C4EF"
                Text="10:00:00" />
        </Border>

  看起来的效果:

 

 

 

 

posted @ 2021-06-27 13:09  wangjinming  阅读(1588)  评论(0编辑  收藏  举报