zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    MySQL 子查询
    MySQL 多表查询 内连接 和 外连接
    MySQL 分页
    MySQL 常用函数 流程控制
    Envoy基于文件系统的EDS动态配置
    Envoy学习笔记
    dapr入门学习
    浅谈cache
    List的初始化方式
    屌丝公司:设置服务器的时区、时间及时间同步
  • 原文地址:https://www.cnblogs.com/teyond/p/2455127.html
Copyright © 2011-2022 走看看