WFP loading 窗口显示 SplashScreen
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
SplashScreen splashScreen = new SplashScreen("pic.jpg");
splashScreen.Show(true);
base.OnStartup(e);
}
}
这个系统自带的 SplashScreen 不是太好,不能自定义。。。
下面是我自定义的 SplashWind :
canCloseSplash 用来判断是否可以关闭这个loading自定义窗口。原理是在主窗口的Loaded事件里设置 App.canCloseSplash =true;
在自定义的SplashWind 里用个计时器检查 App.canCloseSplash 是否=true,等于的话就关闭自己。
public partial class App : System.Windows.Application
{
public static bool canCloseSplash = false; protected override void OnStartup(System.Windows.StartupEventArgs e)
{
SplashWind splashWind = new SplashWind();
splashWind.Show();
// System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("1.jpg");
// splashScreen.Show(true,true);
base.OnStartup(e); }
}
public partial class SplashWind : Window
{
public SplashWind()
{
InitializeComponent();
Topmost = true;
t.Interval = TimeSpan.FromMilliseconds(30);
t.Tick += new EventHandler(t_Tick);
t.Start();
} DispatcherTimer t = new DispatcherTimer(); void t_Tick(object sender, EventArgs e)
{
if (App.canCloseSplash) {
t.Stop();
Close(); }
} }
SplashWind UI:
<Window x:Class="TestWebBrowser.SplashWind"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SplashWind" Height="313" Width="509"
ResizeMode="NoResize" WindowStyle="None" ShowInTaskbar="False"
WindowStartupLocation="CenterScreen" Background="Blue" BorderThickness="5" BorderBrush="AliceBlue"
>
<Grid>
<Label Foreground="White" FontSize="22" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">Loading........</Label>
</Grid>
</Window>
主窗口Loaded事件里告诉SplashWind可以关闭了:
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
App.canCloseSplash = true;
}
WFP loading 窗口显示 SplashScreen的更多相关文章
- Windows MFC 两个OpenGL窗口显示与线程RC问题
问题为:背景界面是一个OpenGL窗口(对话框),在其上弹出一个OpenGL窗口(模态对话框)时, 1.上方的OpenGL窗口能响应鼠标操作等并刷新: 2.当移动或放大缩小上方的OpenGL窗口时,其 ...
- 关于ajax载入窗口使用RedirectToAction在窗口显示的问题
在过滤器中过滤用户是否登录,没有登录就RedirectToAction("Login", "Auth", new { Area = "Account& ...
- Android: Service中创建窗口显示
WindowManager.LayoutParams: int TYPE_SYSTEM_ALERT Window type: system window, such as low power ale ...
- Win32编程:窗口类样式+窗口外观样式+窗口显示样式
1.窗口类样式WNDCLASS.style CS_VREDRAW 提供窗口位置变化事件和高度变化事件的处理程序,功能是重绘窗口 CS_HREDRAW 提供窗口位置变化事件和宽度变化事件的处理程序,功能 ...
- visual studio 2005 编fortran程序,运行后dos窗口显示问题
比如程序: program main implicit none write(*,*) "AAAAAAAAAAAAAAAAAAAAAAAA" stop end 虽然可以看见DOS窗 ...
- jquery ajax请求方式与提示用户正在处理请稍等,等待数据返回时loading的显示
1.jquery ajax请求方式与提示用户正在处理请稍等 为了提高用户体验度,我们通常会给出 “正在处理,请稍等!”诸如此类的提示.我们可通过设置$.ajax()下的参数beforeSend()来实 ...
- QApplication::alert 如果窗口不是活动窗口,则会向窗口显示一个警告(非常好用,效果就和TeamViewer一样)
void QApplication::alert(QWidget * widget, int msec = 0)如果窗口不是活动窗口,则会向窗口显示一个警告.警报会显示msec 毫秒.如果毫秒为零,闪 ...
- 转】MySQL客户端输出窗口显示中文乱码问题解决办法
原博文出自于: http://www.cnblogs.com/xdp-gacl/p/4008095.html 感谢! 最近发现,在MySQL的dos客户端输出窗口中查询表中的数据时,表中的中文数据都显 ...
- Android 应用程序窗口显示状态操作(requestWindowFeature()的应用)
我们在开发程序是常常会须要软件全屏显示.自己定义标题(使用button等控件)和其它的需求,今天这一讲就是怎样控制Android应用程序的窗口显示. 首先介绍一个重要方法那就是requestWi ...
随机推荐
- Markdown 语法笔记
一.标题 markdown 中的标题用 # 表示,# 的个数表示标题级别,一级标题相当于 h1,二级标题 h2,以此类推 # 一级标题 ## 二级标题 ### 三级标题 #### 四级标题 ##### ...
- SD从零开始15-18
SD从零开始15 税(Taxes) 税确定的标准Criteria for tax determination 你可以在sales organization level分配一个rule(blank,A, ...
- FineReport连接多维数据库示例及操作
1. 描述 FineReport连接多维数据库,首先要通过数据连接将多维数据库与FineReport连接起来,然后在数据连接的基础上新建多维数据库XMLA数据集,用于模板设计. 2.XMLA数据连接 ...
- Asp.net MVC检测到有潜在危险的 Request.Form 值
解决方法很简单,不像网上说的那么麻烦.只需一步: [ValidateInput(false)] public ActionResult Test(){ }
- web导出excel文件的几种方法
总的来说,两种方法:服务器端生成和浏览器端生成. 服务器端生成就是:根据用户请求,获取相应的数据,使用poi/jxl, jacob/jawin+excel,或是用数据拼html的table或是cvs纯 ...
- Resource View Window of Visual Studio
https://msdn.microsoft.com/en-us/library/d4cfawwc.aspx For the latest documentation on Visual Studio ...
- RecyclerView嵌套TextView时显示文字不全的解决方法之一
先描述一下这个小bug:简单的TextView嵌套RecyclerView作为itemView时,可能会在文本中出现布局覆盖的现象,itemView的布局其实很简单,就是一个RelativeLayou ...
- 读高性能JavaScript编程 第三章
第三章 DOM Scripting 最小化 DOM 访问,在 JavaScript 端做尽可能多的事情. 在反复访问的地方使用局部变量存放 DOM 引用. 小心地处理 HTML 集合,因为他们表现 ...
- November 11th, 2017 Week 45th Saturday
Happiness is a direction, not a place. 快乐是一个方向,不是一个目的. Do you remember those moments in your life wh ...
- JFreeChart绘制XY折线图(工具类设计)
准备用Java写通信的仿真平台作为毕业设计,相比matlab绘图,Java绘图需要自己去写很多工具类,博主在这采用了JFreeChart的开源解决方案,摸索着自己写了一个XY折线图工具类,话不多说贴源 ...