C# 最小化后无法显示主窗口
我试图通过立即说出我想要什么,然后说出我得到什么来避免XY问题 简单地说,创建一些类级整数变量,并将高度、宽度和定位值存储在其中。然后使用它们返回窗口的大小:C# 最小化后无法显示主窗口,c#,wpf,show,minimize,C#,Wpf,Show,Minimize,我试图通过立即说出我想要什么,然后说出我得到什么来避免XY问题 简单地说,创建一些类级整数变量,并将高度、宽度和定位值存储在其中。然后使用它们返回窗口的大小: int height; int width; double left; double top; private void MainWindow_SizeChanged { height = this.Height; width = this.Widthl left = this.Left; top = this
int height;
int width;
double left;
double top;
private void MainWindow_SizeChanged
{
height = this.Height;
width = this.Widthl
left = this.Left;
top = this.Top;
}
private void ShowMainWindow(object sender, EventArgs e)
{
this.Height = height;
this.Width = width;
this.Left = left;
this.Top = top;
}
简单地说,创建一些类级整数变量,并将高度、宽度和定位值存储在其中。然后使用它们返回窗口的大小:
int height;
int width;
double left;
double top;
private void MainWindow_SizeChanged
{
height = this.Height;
width = this.Widthl
left = this.Left;
top = this.Top;
}
private void ShowMainWindow(object sender, EventArgs e)
{
this.Height = height;
this.Width = width;
this.Left = left;
this.Top = top;
}
只需在显示窗口时更改操作顺序即可
private void ShowMainWindow(object sender, EventArgs e)
{
Show();
WindowState = WindowState.Normal;
Topmost = true;
Activate();
}
只需在显示窗口时更改操作顺序即可
private void ShowMainWindow(object sender, EventArgs e)
{
Show();
WindowState = WindowState.Normal;
Topmost = true;
Activate();
}
在ShowMainWindow方法中,您在何处使用
WindowState.Maximized
。我更新了问题。现在Maximix都不起作用了。在ShowMainWindow方法中,您在哪里使用WindowsState.Maximized
。我更新了问题。现在Maximix都不起作用了。在Show()方法之后移动WindowsState赋值解决了我的问题。非常感谢。在Show()方法之后移动WindowsState分配解决了我的问题。非常感谢。