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 ...
随机推荐
- PDO添加数据的预处理语句
1.添加页面<h1>添加数据</h1><form action="chuli.php" method="post"> < ...
- HttpWatch HttpWatch时间表(HttpWatch Time Charts)
HttpWatch时间表(HttpWatch Time Charts) by:授客 QQ:1033553122 截图 说明 页面事件线(Page Event Lines)
- 大数据【四】MapReduce(单词计数;二次排序;计数器;join;分布式缓存)
前言: 根据前面的几篇博客学习,现在可以进行MapReduce学习了.本篇博客首先阐述了MapReduce的概念及使用原理,其次直接从五个实验中实践学习(单词计数,二次排序,计数器,join,分 ...
- Android--用JS去控制WebView显示的字体的大小
<script type="text/javascript"> function changeFontSize(size) { var tfs = '120%'; va ...
- CSS3新特性,兼容性,兼容方法总结
css3手册css3手册 边框 border-radius 用于添加圆角效果 语法: border-radius:[ <length> | <percentage> ]{1,4 ...
- 控制台中寄宿WCF服务
一.首先创建一个类库,用来定义WCF服务 修改服务代码定义,具体代码如下 // 注意: 使用"重构"菜单上的"重命名"命令,可以同时更改代码和配置文件中的接口名 ...
- Ionic命令大全
start [options] <PATH> [template] ............. Starts a new Ionic project in the specified P ...
- textbox只允许输入数字
private void txtUserId_KeyPress(object sender, KeyPressEventArgs e) { //如果输入的不是数字键,也不是回车键.Backspace键 ...
- fab提供远程IP和账号密码
#!/usr/bin/python #-*- coding: UTF-8 -*- from fabric.api import * from fabric.context_managers impor ...
- TMOUT优化终端超时
有时候,管理员终端登陆了系统,如果离开没有退出账户,则会有安全隐患存在,因此需要优化终端超时. 设置终端超时: export TMOUT=10 永久生效: echo "export TMOU ...