• 大小: 0.14M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-02-27
  • 语言: C#
  • 标签: winform  wpf  

资源简介

两个属性一个事件

WindowStyle="None" 去标题

 AllowsTransparency="True"  去边框

 MouseMove="TitleBar_MouseMove" 鼠标拖动标题栏

        // 支持标题栏拖动
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            // 获取鼠标相对标题栏位置
            Point position = e.GetPosition(TitleBar);

            // 如果鼠标位置在标题栏内,允许拖动
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (position.X >= 0 && position.X < TitleBar.ActualWidth && position.Y >= 0 && position.Y < TitleBar.ActualHeight)
                {
                    this.DragMove();
                }
            }
        }

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace WpfApplication1
{
    /// 
    /// App.xaml 的交互逻辑
    /// 

    public partial class App : Application
    {
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-10-06 07:11  WpfApplication1\
     文件         935  2013-10-03 18:47  WpfApplication1.sln
     文件       78848  2013-10-06 06:54  WpfApplication1.v11.suo
     文件         187  2013-10-03 18:46  WpfApplication1\App.config
     文件         323  2013-10-06 06:54  WpfApplication1\App.xaml
     文件         342  2013-10-03 18:46  WpfApplication1\App.xaml.cs
     目录           0  2013-10-06 07:13  WpfApplication1\bin\
     目录           0  2013-10-06 07:13  WpfApplication1\bin\Release\
     文件       22984  2013-10-05 21:04  WpfApplication1\bin\Release\WpfApplication1.vshost.exe
     文件        1897  2013-10-05 16:02  WpfApplication1\CustomControl1.cs
     文件         194  2013-10-05 16:00  WpfApplication1\Dictionary1.xaml
     文件         215  2013-10-05 16:01  WpfApplication1\FlowDocument1.xaml
     文件         298  2013-10-05 21:03  WpfApplication1\MainWindow.xaml
     文件         661  2013-10-03 18:46  WpfApplication1\MainWindow.xaml.cs
     目录           0  2013-10-05 21:03  WpfApplication1\obj\
     目录           0  2013-10-05 21:03  WpfApplication1\obj\Debug\
     文件        2443  2013-10-05 21:03  WpfApplication1\obj\Debug\App.g.cs
     文件        2443  2013-10-05 21:03  WpfApplication1\obj\Debug\App.g.i.cs
     文件        7076  2013-10-05 21:03  WpfApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         548  2013-10-05 21:03  WpfApplication1\obj\Debug\Dictionary1.baml
     文件         531  2013-10-05 21:03  WpfApplication1\obj\Debug\FlowDocument1.baml
     文件           7  2013-10-05 21:03  WpfApplication1\obj\Debug\GeneratedInternalTypeHelper.g.cs
     文件        3015  2013-10-05 21:03  WpfApplication1\obj\Debug\GeneratedInternalTypeHelper.g.i.cs
     文件         708  2013-10-05 21:03  WpfApplication1\obj\Debug\MainWindow.baml
     文件        3024  2013-10-05 21:03  WpfApplication1\obj\Debug\MainWindow.g.cs
     文件        3024  2013-10-05 21:03  WpfApplication1\obj\Debug\MainWindow.g.i.cs
     文件         818  2013-10-05 21:03  WpfApplication1\obj\Debug\Page1.baml
     文件        3006  2013-10-05 21:03  WpfApplication1\obj\Debug\Page1.g.cs
     文件        3006  2013-10-05 21:03  WpfApplication1\obj\Debug\Page1.g.i.cs
     文件        1028  2013-10-05 21:03  WpfApplication1\obj\Debug\PageFunction1.baml
     文件        3064  2013-10-05 21:03  WpfApplication1\obj\Debug\PageFunction1.g.cs
............此处省略87个文件信息

评论

共有 条评论