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>
相关推荐
User_芊芊君子5 小时前
【分布式训练】CANN SHMEM跨设备内存通信库:构建高效多机多卡训练的关键组件
分布式·深度学习·神经网络·wpf
就是有点傻1 天前
WPF按钮走马灯效果
wpf
zuozewei1 天前
虚拟电厂聚合商平台安全技术体系深度解读
安全·wpf
极客智造1 天前
WPF 自定义控件:AutoGrid 实现灵活自动布局的网格控件
wpf
极客智造1 天前
WPF Grid 布局高效扩展:GridHelpers 附加属性工具类全解析
wpf
张人玉1 天前
WPF 多语言实现完整笔记(.NET 4.7.2)
笔记·.net·wpf·多语言实现·多语言适配
暖馒1 天前
深度剖析串口通讯(232/485)
开发语言·c#·wpf·智能硬件
我要打打代码2 天前
WPF控件(2)
wpf
c#上位机2 天前
wpf之行为
c#·wpf
kylezhao20192 天前
深入浅出地理解 C# WPF 中的属性
hadoop·c#·wpf