WPF:最小化状态 System.Windows.Window
WPF: State of Minimized System.Windows.Window
如何知道 System.Windows.Window 在最小化之前是在 WindowState.Normal 还是 WindowState.Maximized?
除非您自己跟踪之前的状态,否则您不会这样做:
private WindowState _previousState = WindowState.Normal;
private void MainWindow_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
if (_previousState == WindowState.Maximized)
{
MessageBox.Show("Window was in maximized state before being minimized");
}
else
{
MessageBox.Show("Window was in normal state before being minimized");
}
}
_previousState = WindowState;
}
恐怕没有"PreviousWindowState"属性可用。
如何知道 System.Windows.Window 在最小化之前是在 WindowState.Normal 还是 WindowState.Maximized?
除非您自己跟踪之前的状态,否则您不会这样做:
private WindowState _previousState = WindowState.Normal;
private void MainWindow_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
if (_previousState == WindowState.Maximized)
{
MessageBox.Show("Window was in maximized state before being minimized");
}
else
{
MessageBox.Show("Window was in normal state before being minimized");
}
}
_previousState = WindowState;
}
恐怕没有"PreviousWindowState"属性可用。