zoukankan      html  css  js  c++  java
  • WPF无边框可拖动窗体

    下面主要记录下创建无边框窗体,并且可以拖动。这种窗体主要用于弹出小窗体时。

    <Window x:Class="WpfApplication1.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:WpfApplication1"
            mc:Ignorable="d" WindowStyle="None"
            Title="MainWindow" Height="350" Width="525"  AllowsTransparency="True">
    
        <Grid Name="grid" Height="350" Width="525" Background="Transparent">       
        </Grid>   
    </Window>

    这里需要注意的是grid控件一定要设置一个background的用于焦点的捕捉。

    后台代码:

      public MainWindow()
            {
                InitializeComponent();
                this.grid.MouseLeftButtonDown += (o, e) => { DragMove(); };
            }

    这样就可以实现拖动窗体功能。

  • 相关阅读:
    wireshark安装
    高效使用搜索引擎
    MFC 网络编程 -- 总结
    MFC Grid control 2.27
    A Popup Progress Window
    Showing progress bar in a status bar pane
    Progress Control with Text
    Report List Controls
    第三方
    CBarChart柱形图类
  • 原文地址:https://www.cnblogs.com/qcst123/p/12039148.html
Copyright © 2011-2022 走看看