首页 > 其他分享 >WPF this.DragMove() DropShadowEffect

WPF this.DragMove() DropShadowEffect

时间:2024-09-14 23:46:46浏览次数:1  
标签:Windows Media System MainWindow DropShadowEffect using WPF DragMove

//xaml
<Window x:Class="WpfApp367.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:WpfApp367"
        mc:Ignorable="d"
        AllowsTransparency="True"
        WindowStyle="None"
        Background="Transparent"
        MouseLeftButtonDown="Window_MouseLeftButtonDown"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <Ellipse Fill="Red" Opacity="0.5"
                 Margin="20">
            <Ellipse.Effect>
                <DropShadowEffect/>
            </Ellipse.Effect>
        </Ellipse>
        <Button Margin="100" Click="Button_Click">Close</Button>
    </Grid>
</Window>


//cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp367
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}

 

 

 

 

 

 

标签:Windows,Media,System,MainWindow,DropShadowEffect,using,WPF,DragMove
From: https://www.cnblogs.com/Fred1987/p/18414857

相关文章

  • 不可不知的WPF转换(Transform)
    在WPF开发中,经常会需要用到UI控件的2D转换(如:旋转,缩放,移动,倾斜等功能),本文以一些简单的小例子,简述如何通过Transform类实现FrameworkElement对象的2D转换,仅供学习分享使用,如有不足之处,还请指正。 什么是Transform? 转换(Transform)定义如何将控件从一个坐标空间映射或转换到另一......
  • [WPF]XAML中使用IMultiValueConverter实现Command的多参数传参
    对ICommand进行多参数传参问题如何对ICommand传入多个参数?背景最近在做一个WPF的开发,有多个相近的功能写了不同的Command,因为要对应不同的对象。因为是CtrlCV,显得代码有点冗赘不够优雅,但是ICommand又只能接受一个参数。思路使用MultiBinding,对CommandParameter进行绑定,然后......
  • WPF datagrid contextmenu menuitem commandparameter CommandParameter="{Binding R
    Install-packagenewtonsoft.json  <DataGrid.ContextMenu><ContextMenu><MenuItemHeader="ExportSelected"Command="{BindingExportSelectedCmd}"CommandParameter="{BindingRelativeSource={Relat......
  • 自定义WPF滑块样式-Slider
    在Windows应用程序开发中,滑块(Slider)是一个非常常见且有用的控件。它可以让用户通过拖动滑块来选择一个范围内的值。然而,WPF或UWP应用程序中的默认滑块样式可能并不总是符合我们的设计需求。因此,我们需要自定义滑块的样式。在本文中,我将向你展示如何使用XAML(ExtensibleApplicat......
  • WPF Datagrid DataGridTemplateColumn.CellTemplate local:ImageTextblock ImgUrl="{
    DataGridTemplate.CellTemplatecontainsonedatatemplaewilldisplaythecustomoizedcontrol,thekeylocatedatthecustomcontrol'sdependencypropertybindingandrelativesourceofx:typedatagridrow<local:ImageTextblockImgUrl="{Binding......
  • wpf模拟触摸
    ///<summary>///UsethisClassesstaticmethodstoinitializeandinjecttouchinput.///</summary>publicclassNativeMethods{///<summary>///CallthisfirsttoinitializetheTouchInjection!///</summary>......
  • WPF 实现一个吃豆豆的Loading加载动画
    运行的效果如下 先引入一下我们需要的库在nuget上面搜一下"expression.Drawing",安装一下这个包 我们再创建一个Window,引入一下这个包的命名空间我们设置一下这个加载动画呈现的窗体的样式xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"......
  • WPF MVVM入门系列教程(一、MVVM模式介绍)
    为什么写这些博客?还记得早些年刚工作的那会,公司的产品从Delphi转成了WPF(再早些年是mfc)。当时大家也是处于一个对WPF探索的阶段,所以有很多概念都不是非常清楚。但是大家都想堆技术,就提出使用MVVM,我那会是第一次听到MVVM,在网上看了一些资料后,也难以理解,后面也是硬着头皮在写。有......
  • DevExpress WPF中文教程:如何解决排序、过滤遇到的常见问题?(二)
    DevExpressWPF拥有120+个控件和库,将帮助您交付满足甚至超出企业需求的高性能业务应用程序。通过DevExpressWPF能创建有着强大互动功能的XAML基础应用程序,这些应用程序专注于当代客户的需求和构建未来新一代支持触摸的解决方案。无论是Office办公软件的衍伸产品,还是以数据为中心......
  • WPF树形菜单
    WPF保姆级教程怎么实现一个树形菜单 先看一下效果吧:   我们直接通过改造一下原版的TreeView来实现上面这个效果我们先创建一个普通的TreeView代码很简单:<TreeView><TreeViewItemHeader="人事部"/><TreeViewItemHeader="技......