0

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

 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;

        }
    }

但是无论你在哪里点击表格,它都会一直正常化

4

1 回答 1

0

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

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;

}
}
于 2016-05-04T21:53:06.193 回答