简体   繁体   English

如何更改启动画面大小?

[英]How to change splash screen size?

I'm using WPF on C#, I added a *.png image and configure it as a splash screen.我在 C# 上使用 WPF,我添加了一个*.png图像并将其配置为启动画面。

This png file has resolution is 1100x800 pixels, The problem is my application will support many resolution of screens.这个 png 文件的分辨率为 1100x800 像素,问题是我的应用程序将支持多种屏幕分辨率。

So this splash screen with this size will so large for small screen (as 1366x768 screens).所以这个尺寸的启动画面对于小屏幕(如 1366x768 屏幕)来说会很大。

If I scale down size of splash screen, this make it too small for the large screens (as 1920x1080 screens).如果我缩小启动画面的大小,这对于大屏幕(如 1920x1080 屏幕)来说太小了。

So I want to change size of splash screen dynamically for each monitor screen.所以我想为每个监视器屏幕动态更改初始屏幕的大小。

Is there any way to do it?有什么办法吗?

You cannot.你不能。 The splash screen is embedded inside the manifest and is shown by .net before any of your code is loaded.启动画面嵌入在清单中,并在加载任何代码之前由 .net 显示。

You will need to create a custom window and display it manually.您将需要创建一个自定义窗口并手动显示它。 However, any static references will be loaded already - you will still get a delay.但是,任何静态引用都将被加载 - 您仍然会得到延迟。 This subverts the whole point of having a splash screen.这颠覆了拥有启动画面的全部意义。

Consider just choosing the smallest image you will ever need.考虑只选择您需要的最小图像。

You cannot do this using a PNG, it will always render a fixed size.您不能使用 PNG 执行此操作,它始终会呈现固定大小。 You should create a custom splash screen.您应该创建一个自定义启动画面。 This CodeProject article has a nice tutorial on how to do it. 这篇 CodeProject 文章有一个关于如何做到这一点的很好的教程。

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

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