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>

  • 相关阅读:
    发现WPF在Windows 7 的一个BUG ,多点触摸开发的注意了
    广度优先搜索 与 深度优先算法
    log4net window UAC下无法记录解决
    简单网页制作
    JS常用属性
    JS for循环、if判断、white循环。
    mysql 查询
    HTML学习随笔
    JS小练习
    mysql增删改
  • 原文地址:https://www.cnblogs.com/teyond/p/2455127.html
Copyright © 2011-2022 走看看