WPF Border 妙用,切图


csharp 复制代码
<Window x:Class="WpfDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfDemo"
        mc:Ignorable="d"
              Title="Window1" Height="650" Width="650">
    <WindowChrome.WindowChrome>
        <WindowChrome NonClientFrameEdges="None" UseAeroCaptionButtons="False"/>
    </WindowChrome.WindowChrome>
    <Grid >
        <Grid.Background>
            <RadialGradientBrush GradientOrigin="0.8,0.8" 
                                 Center="0.8,0.8"
                                 RadiusX="0.7" RadiusY="1">
                <GradientStop Color="#103156" Offset="0"></GradientStop>
                <GradientStop Color="#141627" Offset="1.5"></GradientStop>
            </RadialGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Path Data="M0 0 0 35 200 35 
              C 210 35 210 35 218 38
              C 226 46 226 46 236 46 
              L406 46
              C414 46 414 46 422 38
              C430 35 430 35 440 35
              L640 35 640 0" >
            <Path.Fill>
                <RadialGradientBrush GradientOrigin="0.5,1.5"
                                     Center="0.5,1"
                                     RadiusX="0.12" RadiusY="0.5">
                    <GradientStop Color="#1B75E7" Offset="0"></GradientStop>
                    <GradientStop Color="#144594" Offset="0.4"></GradientStop>
                    <GradientStop Color="#0D213C" Offset="1"></GradientStop>
                </RadialGradientBrush>
            </Path.Fill>
            <Path.Stroke>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                    <GradientStop Color="Transparent" Offset="0"></GradientStop>
                    <GradientStop Color="#47D9FF" Offset=".5"></GradientStop>
                    <GradientStop Color="Transparent" Offset="1"></GradientStop>
                </LinearGradientBrush>
            </Path.Stroke>
        </Path>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition Width="auto"></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock Text="XXXXXXXXXXXXXXXX" VerticalAlignment="Center" Foreground="#9FFF" FontSize="16" Grid.Column="1" Margin="50,5,50,0"></TextBlock>
            <Border BorderBrush="#1B436E" VerticalAlignment="Center" BorderThickness="0,0,2,0" Margin="0,0,4,0" Height="14">
                <Border.RenderTransform>
                    <SkewTransform AngleX="-45"></SkewTransform>
                </Border.RenderTransform>
                <Border BorderBrush="#1B436E" BorderThickness="0,0,2,0" Margin="0,0,4,0">
                    <Border Margin="0,0,4,0">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                <GradientStop Color="#0D213c" Offset="0"></GradientStop>
                                <GradientStop Color="#1B436E" Offset="1"></GradientStop>
                                
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Border>
            </Border>
            <Border Grid.Column="2" BorderBrush="#1B436E" VerticalAlignment="Center" BorderThickness="2,0,0,0" Margin="4,0,0,0" Height="14">
                <Border.RenderTransform>
                    <SkewTransform AngleX="-135"></SkewTransform>
                </Border.RenderTransform>
                <Border BorderBrush="#1B436E" BorderThickness="2,0,0,0" Margin="4,0,0,0">
                    <Border Margin="4,0,0,0">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                <GradientStop Color="#1B436E" Offset="0"></GradientStop>
                                <GradientStop Color="#0D213c" Offset="1"></GradientStop>
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Border>
            </Border>
        </Grid>
    </Grid>
</Window>
相关推荐
没有bug.的程序员10 小时前
SOA、微服务、分布式系统的区别与联系
java·jvm·微服务·架构·wpf·日志·gc
Macbethad10 小时前
基于WPF的半导体设备配方管理程序技术方案
wpf
FuckPatience11 小时前
WPF Geometry
wpf
武藤一雄1 天前
.NET 中常见计时器大全
microsoft·微软·c#·.net·wpf·.netcore
MarkHD1 天前
车辆TBOX科普 第70次 AUTOSAR Adaptive、容器化与云原生的融合革命
云原生·wpf
极客智造1 天前
WPF Behavior 实战:自定义 InvokeCommandAction 实现事件与命令解耦
wpf
L、2181 天前
Flutter 与 OpenHarmony 深度集成:构建分布式多端协同应用
分布式·flutter·wpf
布伦鸽1 天前
C# WPF -MaterialDesignTheme 找不到资源“xxx“问题记录
开发语言·c#·wpf
小二·2 天前
MyBatis基础入门《十五》分布式事务实战:Seata + MyBatis 实现跨服务数据一致性
分布式·wpf·mybatis
helloworddm2 天前
UnregisterManyAsync
wpf