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>
相关推荐
九鼎科技-Leo10 小时前
什么是 WPF 中的依赖属性?有什么作用?
windows·c#·.net·wpf
麻花201320 小时前
C#之WPF的C1FlexGrid空间的行加载事件和列事件变更处理动态加载的枚举值
开发语言·c#·wpf
lcintj20 小时前
【WPF】Prism学习(九)
学习·wpf·prism
界面开发小八哥21 小时前
界面控件DevExpress WPF中文教程:网格视图数据布局的列和卡片字段
wpf·界面控件·devexpress·ui开发·用户界面
△曉風殘月〆21 小时前
如何在WPF中嵌入其它程序
wpf
Crazy Struggle21 小时前
功能齐全的 WPF 自定义控件资源库(收藏版)
.net·wpf·ui控件库
shepherd枸杞泡茶1 天前
WPF动画
c#·.net·wpf
lcintj1 天前
【WPF】Prism学习(十)
学习·wpf·prism
wyh要好好学习1 天前
WPF数据加载时添加进度条
ui·wpf
code_shenbing1 天前
跨平台WPF框架Avalonia教程 三
前端·microsoft·ui·c#·wpf·跨平台·界面设计