WPF SplashScreen 实现 [英] WPF SplashScreen implementing

查看:40
本文介绍了WPF SplashScreen 实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 WPF 中实现 Splash Screnn.我在 MSDN 上找到了一些不错的例子,但只有一个地方:

private void _applicationInitialize(SplashScreen splashWindow){线程睡眠(1000);//创建主窗口,但在 UI 线程上.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Invoker)delegate{Window1 MainWindow = new Window1();Helper.setWin(MainWindow);MainWindow.Show();});}

问题是Helper,类是什么以及它必须如何实现.有人可以粘贴一个例子或什么?

解决方案

还有一个更简单的方法:

http://msdn.microsoft.com/en-us/library/cc656886.aspx

<块引用>

  1. 将图像文件添加到 WPF 应用程序项目.有关更多信息,请参见如何:将现有项添加到项目.
  2. 在解决方案资源管理器中,选择图像.
  3. 在属性"窗口中,单击构建操作"属性的下拉箭头.
  4. 从下拉列表中选择 SplashScreen

I try to implement Splash Screnn in WPF. I have found some nice ehample in MSDN, but there is one place:

private void _applicationInitialize(SplashScreen splashWindow)
{

    Thread.Sleep(1000);

    // Create the main window, but on the UI thread.

    Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Invoker)delegate
    {

        Window1 MainWindow = new Window1();

        Helper.setWin(MainWindow);

        MainWindow.Show();

    });

}

The problem is Helper, whats the class is there and how it must be implemented. Someone could paste an example or smth?

解决方案

There is an even easier way:

http://msdn.microsoft.com/en-us/library/cc656886.aspx

  1. Add the image file to the WPF Application project. For more information, see How to: Add Existing Items to a Project.
  2. In Solution Explorer, select the image.
  3. In the Properties window, click the drop-down arrow for the Build Action property.
  4. Select SplashScreen from the drop-down list

这篇关于WPF SplashScreen 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆