带有用户控件的 WPF SplashScreen
我正在使用 WPF SplashScreen-Class(在 System.Windows 命名空间中定义)。构造函数需要一个“resourceName”参数。
是否有机会指定用户控件而不是图像文件?如果这是不可能的:有什么方法可以将用户控件保存到图像文件中吗?
// Assembly WindowsBase.dll, v2.0.50727
using System;
using System.Reflection;
using System.Security;
namespace System.Windows
{
public class SplashScreen
{
public SplashScreen(string resourceName);
[SecurityCritical]
public SplashScreen(Assembly resourceAssembly, string resourceName);
[SecurityCritical]
public void Close(TimeSpan fadeoutDuration);
[SecurityCritical]
public void Show(bool autoClose);
}
}
I'm using the WPF SplashScreen-Class (defined in System.Windows Namespace). The constructor expects a 'resourceName' parameter.
Is there any opportunity to specify an UserControl, instead of an image file? If this is not possible: Is there any way to save an UserControl into an image file?
// Assembly WindowsBase.dll, v2.0.50727
using System;
using System.Reflection;
using System.Security;
namespace System.Windows
{
public class SplashScreen
{
public SplashScreen(string resourceName);
[SecurityCritical]
public SplashScreen(Assembly resourceAssembly, string resourceName);
[SecurityCritical]
public void Close(TimeSpan fadeoutDuration);
[SecurityCritical]
public void Show(bool autoClose);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用图像而不是控件的全部目的是避免在启动启动屏幕之前加载 WPF 程序集和基础结构的成本。因此,用户在启动应用程序时会尽快获得更多反馈。
如果您的初始屏幕不需要任何动态或交互性,您可以简单地创建一个分层图像文件(例如使用 PaintdotNET 或 Photoshop)并从中生成静态图像 (jpeg/png)。使用分层图像文件的优点是您可以轻松指定层来包含定期更改的信息,例如版本号。您甚至可以让构建过程生成静态图像,并替换适当的版本号。
The whole point of using an image rather than a control is to avoid the cost of loading up WPF assemblies and infrastructure prior to getting the splash screen up. Thus, the user gets more feedback as quickly as possible when starting your application.
If you don't need any dynamism or interactivity in your splash screen, you can simply create a layered image file (using PaintdotNET or Photoshop for example) and generate a static image from that (jpeg/png). The advantage of using a layered image file is that you can easily designate layers to contain information that changes periodically, such as a version number. You could even have your build process generate the static image with the appropriate version number substituted.