如何设置WPF窗口大小是相对监视器屏幕的25% [英] How can I set WPF window size is 25 percent of relative monitor screen
本文介绍了如何设置WPF窗口大小是相对监视器屏幕的25%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个WPF窗口,如何设置WPF窗口大小是相对监视器屏幕的25%。如何设置这些属性。
I have a WPF window and How can I set WPF window size is 25 percent of relative monitor screen.How can I set these properties.
推荐答案
在您的MainWindow构造函数中添加
In your MainWindow Constructor add
this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight * 0.25);
this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth * 0.25);
也不要在MainWindows.xaml中设置WindowState = Maximized,否则它将不起作用。
希望这会有所帮助。
Also don't set WindowState="Maximized" in your MainWindows.xaml otherwise it won't work. Hope this helps.
这篇关于如何设置WPF窗口大小是相对监视器屏幕的25%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文