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 ...
随机推荐
- ubutu强制关闭应用程序的方法
1.打开终端,输入命令 top 2.查看应用程序PID号,比如是8080 3.然后终端输入 kill 8080 ,行了
- Jmeter 测试结果分析之聚合报告简介
Jmeter 测试结果分析之聚合报告简介 by:授客 QQ:1033553122 聚合报告(aggregate report) 对于每个请求,它统计响应信息并提供请求数,平均值,最大,最小值,错误率, ...
- [iOS] UICollectionView初始化滚动到中间的bug
转载请保留地址wossoneri.com 问题 首先看一下我之前写的demo:link demo是封装了一个控件,直接在MainViewController的viewWillAppear里初始化,并且 ...
- Python+Selenium笔记(十一):配置selenium Grid
(一) 前言 Selenium Grid可以将测试分布在若干个物理或虚拟机器上,从而实现分布方式或并行方式执行测试. 这个链接是官方的相关说明. https://github.com/Selenium ...
- 10款jQuery文本高亮插件
[编者按]本文作者为 Julian Motz,主要介绍十款 jQuery 文本高亮插件的现状.文章系国内 ITOM 管理平台 OneAPM 编译呈现. 很多应用或网站都为用户提供搜索关键词的方法.为了 ...
- go语言练习:文件哈希
package main import ( "crypto/sha256" "encoding/hex" "fmt" "io&qu ...
- Web服务架构风格之REST
REST(Representational State Transfer)是一种Web服务的架构,其目的是创建具有良好扩展性的分布式系统.它的约束包含: 使用C/S模型.client和server之间 ...
- LeetCode题解之 Longest Common Prefix
1.题目描述 2.问题分析 直接使用循环解决问题 3.代码 string longestCommonPrefix(vector<string>& strs) { string re ...
- java网页数据抓取实例
在很多行业中,要对行业数据进行分类汇总,及时分析行业数据,对于公司未来的发展,有很好的参照和横向对比.所以,在实际工作,我们可能要遇到数据采集这个概念,数据采集的最终目的就是要获得数据,提取有用的数据 ...
- 免安装PostgreSQL启动服务及创建数据库
安装环境windows7 64位系统 免安装版本postgresql-10.3-1-windows-x64-binaries ===================================== ...