WPF,自定义窗口时移动窗口
我写了一个自定义窗口,窗口的最上方是一个Grid,看起来像是窗口的标题栏,并且我设置了移动窗口的代码:
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
不过,现在出现一个情况,当窗口最大化时,就拖不动窗口了,这是怎么回事呢?该如何修改?
[解决办法]
if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
{
if (this.WinState == WindowState.Maximized)
this.WinState = WindowState.Normal;
this.DragMove();
}
[解决办法]
private void MouseMoveHandler(object sender, System.Windows.Input.MouseEventArgs e)
{
if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
{
if (this.WindowState == WindowState.Maximized)
this.WindowState = WindowState.Normal;
this.DragMove();
}
}
[解决办法]
也可以是你Grid_MouseLeftButtonDown(这个事件里面了
[解决办法]
你绑到MouseMove事件里怎么会点一下就变?你不会绑到MoseDown里吧