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>
相关推荐
xcLeigh4 小时前
WPF进阶 | WPF 数据绑定进阶:绑定模式、转换器与验证
c#·wpf
学与用2 天前
【deepseek实战】绿色好用,不断网
ai·c#·wpf
的不对不3 天前
WPF基础03——InitializeComponent()函数解释
windows·c#·.net·wpf
军训猫猫头4 天前
61.异步编程1 C#例子 WPF例子
开发语言·c#·wpf
时光追逐者4 天前
一组开源、免费、Metro风格的 WPF UI 控件库
ui·开源·c#·.net·wpf·.netcore·微软技术
军训猫猫头4 天前
58.界面参数传递给Command C#例子 WPF例子
开发语言·ui·c#·wpf
xcLeigh5 天前
WPF基础 | 深入 WPF 事件机制:路由事件与自定义事件处理
c#·wpf
军训猫猫头6 天前
60.await与sleep的原理分析 C#例子 WPF例子
开发语言·ui·c#·wpf
敲代码的TKP7 天前
WPF自定义布局--瀑布布局
wpf
xcLeigh8 天前
WPF基础 | WPF 基础概念全解析:布局、控件与事件
c#·wpf