如何使无边框仅在边框顶部拖动时正常化

how to make borderless to normalize on drag only in the top of the border

当你像在浏览器上那样将它拖到顶部时,我如何使我的无边界表单正常化我已经尝试过这个

 private void Window_MouseDown(object sender, MouseButtonEventArgs e)
    {
        if (e.LeftButton == MouseButtonState.Pressed)
        {
            DragMove();

         //   if (WindowState == System.Windows.WindowState.Maximized)

           //     WindowState = System.Windows.WindowState.Normal;

        }
    }

但是无论您在表格的哪个位置单击它,它都会一直正常化

你可以通过在表单顶部制作一个透明标签然后使用这个来实现这个

private void label_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
    DragMove();

    if (WindowState == System.Windows.WindowState.Maximized)

        WindowState = System.Windows.WindowState.Normal;

}
}