• WPF移动不规则渐变色窗体


    要移动窗体,需要在窗体的MouseDown事件中添加如下代码:

            void Window1_MouseDown(object sender, MouseButtonEventArgs e)
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    DragMove();
                }
            }

    <Window x:Class="welcome.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Background="{x:Null}" Height="395" Width="667" WindowStyle="None" AllowsTransparency="True">
       <Canvas Height="395" Width="667">
            <Path Stroke="DarkGray" StrokeThickness="1" Canvas.Left="0" Width="667" Height="395">
                <Path.Data>
                    <PathGeometry>
                        <PathFigure StartPoint="0,20" IsClosed="True">
                            <LineSegment Point="0,375"></LineSegment>
                            <ArcSegment Point="20,395" Size="20,20" ></ArcSegment>
                            <LineSegment Point="647,395"></LineSegment>
                            <ArcSegment Point="667,375" Size="20,20"></ArcSegment>
                            <LineSegment Point="667,20"></LineSegment>
                            <ArcSegment Point="647,0" Size="20,20"></ArcSegment>
                            <LineSegment Point="20,0"></LineSegment>
                            <ArcSegment Point="0,20" Size="20,20"></ArcSegment>
                        </PathFigure>
                    </PathGeometry>
                </Path.Data>
                <Path.Fill>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                        <GradientStop Color="LightYellow"  Offset="0.25"></GradientStop>
                        <GradientStop Color="Yellow" Offset="0.5"></GradientStop>
                        <GradientStop Color="Orange" Offset="0.75"></GradientStop>
                        <GradientStop Color="OrangeRed" Offset="1"></GradientStop>
                    </LinearGradientBrush>
                </Path.Fill>
            </Path>
        </Canvas>
    </Window>

  • 相关阅读:
    Joint Consensus两阶段成员变更的单步实现
    深度干货|云原生分布式数据库 PolarDBX 的技术演进
    SpringMVC框架入门配置 IDEA下搭建Maven项目
    windows安装composer方法和使用方法
    idea2016 spring 新手上路
    jQuery 获取 attr() 与 prop() 属性值的方法及区别介绍 _fei
    处女座的看过来【 JetBrains强迫症】注释篇
    phpstorm 配置 xdebug调试工具
    使用Intellij IDEA整合Spring+Spring MVC+MyBitis
    长链剖分小记
  • 原文地址:https://www.cnblogs.com/teyond/p/2455127.html
Copyright © 2020-2023  润新知