简体   繁体   English

有没有办法调整 UWP 应用程序的大小和居中?

[英]Is there a way to resize and center a UWP app?

I am writing a small UWP app which is going to be launched from another app (the main app).我正在编写一个小型 UWP 应用程序,它将从另一个应用程序(主应用程序)启动。 I am hoping to decrease the window size of the UWP app.我希望减小 UWP 应用程序的 window 大小。

I was able to change the window size by adding the code commented below into the App constructor.通过将下面注释的代码添加到 App 构造函数中,我能够更改 window 大小。 But I couldn't figure out how to make the UWP app center screen after I changed the window size.但是在更改 window 大小后,我无法弄清楚如何制作 UWP 应用程序中心屏幕。 Any advices on making the UWP center screen is appreciated.任何有关制作 UWP 中心屏幕的建议都值得赞赏。

public App()
{
    this.InitializeComponent();
    this.Suspending += OnSuspending;
    ApplicationView.PreferredLaunchViewSize = new Size(600, 400); //added code
    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; //added code
} 

Is there a way to resize and center a UWP app?有没有办法调整 UWP 应用程序的大小和居中?

No, I am afraid there is no API to set the positon of the UWP window:不,恐怕没有 API 来设置 UWP window 的位置:

[UWP] Change the position of window close proximity to the right edge of the screen [UWP] 将 window 的 position 更改为靠近屏幕右边缘

UWP Window Placement UWP Window 贴装

How can I set the Windows position on startup 如何在启动时设置 Windows position

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM