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>

  • 相关阅读:
    IdentityServer4学习笔记
    常用链接地址
    c++ 多线程(2000个)端口扫描(附源码)
    C++ 定时器Timer在项目中的使用
    [Under the hood]---Matt Pietrek October 1996 MSJ
    [under the hood]Reduce EXE and DLL Size with LIBCTINY.LIB
    TN035: Using Multiple Resource Files and Header Files with Visual C++
    单文件版本的netframework的net core 2.1
    Dependency Walker的替代品Dependencies
    怎么使用gradle给spring 打thinjar(gradle 7)
  • 原文地址:https://www.cnblogs.com/teyond/p/2455127.html
Copyright © 2011-2022 走看看