我如何知道 System.Windows.Window 在最小化之前是处于 WindowState.Normal 还是 WindowState.Maximized 中?
问问题
50 次
1 回答
0
除非您自己跟踪以前的状态,否则您不会这样做:
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”属性可用。
于 2018-10-24T15:24:39.497 回答