我需要在所有的工作区调整窗口大小(以屏幕中心)WPF
this.Width = SystemParameters.WorkArea.Width;
this.Height = SystemParameters.WorkArea.Height;
,但窗口不中心位置在屏幕上打开,我该如何定位我的窗口在屏幕中央?
我需要在所有的工作区调整窗口大小(以屏幕中心)WPF
this.Width = SystemParameters.WorkArea.Width;
this.Height = SystemParameters.WorkArea.Height;
,但窗口不中心位置在屏幕上打开,我该如何定位我的窗口在屏幕中央?
修订
如果我使用...
public MainWindow() {
InitializeComponent();
this.Width = SystemParameters.WorkArea.Width;
this.Height = SystemParameters.WorkArea.Height;
this.Top = 0;
this.Left = 0;
}
没有WindowStartupLocation,窗口为中心,充满屏幕
我使用这个,但它错了 – 2012-07-06 07:15:59
也许你应该使用this.Top = 0; this.Left = 0; – Nacho 2012-07-06 07:22:03
在XAML
<Window WindowState="Maximised">
// ...
</Window>
代码隐藏
MyWindow mw = new MyWindow();
mw.WindowState = WindowState.Maximised;
但窗口不是位置世界区域,他是全屏 – 2012-07-06 07:26:43
这样写。 WindowStartupLocation =“CenterScreen”>
请更全面地解释您的答案,它们将对OP和其他人更有用。 – 2012-07-06 11:18:25
您需要**优化您的问题**。正如您通过模糊的答案所看到的,您的问题不足以描述您的问题。 – Adam 2012-07-06 07:32:43