惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
P
Privacy International News Feed
Security Latest
Security Latest
H
Hacker News: Front Page
T
Tenable Blog
The Hacker News
The Hacker News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Security @ Cisco Blogs
Project Zero
Project Zero
O
OpenAI News
AI
AI
Spread Privacy
Spread Privacy
C
CERT Recently Published Vulnerability Notes
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Scott Helme
Scott Helme
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
CXSECURITY Database RSS Feed - CXSecurity.com
NISL@THU
NISL@THU
A
Arctic Wolf
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
N
News and Events Feed by Topic
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
Simon Willison's Weblog
Simon Willison's Weblog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Google Online Security Blog
Google Online Security Blog
罗磊的独立博客
L
LINUX DO - 最新话题
U
Unit 42
S
Security Affairs
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 【当耐特】
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
月光博客
月光博客
Engineering at Meta
Engineering at Meta
腾讯CDC
F
Full Disclosure
Cyberwarzone
Cyberwarzone
S
SegmentFault 最新的问题
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
The Cloudflare Blog

博客园 - 萧萧空间

Windows 2003,XP安装Windows Phone 7 从海量数据中找出中位数(转) 界面开发(五)--- 界面优化 界面开发(四)--- 还窗体的新面貌 界面开发(三)--- 设置窗体的Region 界面开发(二)--- NativeWindow 界面开发(一)--- Hook所有的窗体 界面开发概述 ExtJs扩展之GroupPropertyGrid ExtJs之带图片的下拉列表框 寻找第K大的数的方法总结 我自己的ColorSpy Office 2010 beta版安装 Java反编译工具JD ExtJs Grid Drag Drap 异步窗体实现操作进度(ProgressWindow) 线程封装组件(BackgroundWorker)和线程(Thread) 多线程开发 NSIS 的使用心得
Splash窗体(ProgressWindowForm修改)
萧萧空间 · 2009-11-30 · via 博客园 - 萧萧空间

     上篇中写了一个ProgressWindowForm窗体,主要使用线程来处理系统中执行的大数据量操作的一个多线程解决方案,本次将其修改一下,使用线程去处理系统加载过程中的一些处理事项。

     界面图如下:

     

     这个Splash和原来的ProgressWindowForm的方式一样,只是修改了其中的少许代码,首先 就是本窗体没有了以前的取消方法,删除取消的相关代码就可以了,第二就是窗体不能被强制关闭,也就是说不能使用Alt+F4关闭本窗体,这是很简单的,我在窗体中添加了ProcessDialogKey来去除Alt+F4功能,代码如下:

 1         protected override bool ProcessDialogKey(Keys keyData)
 2         {
 3             switch (keyData)
 4             {
 5                 case Keys.Alt | Keys.F4:
 6                     return true;
 7                 default
 8                     break;
 9             }
10             return base.ProcessDialogKey(keyData);
11         }

   使用Splish的方法就和原来ProgressWindowForm的方法是一样的,主要就是在主窗体显示前,添加如下的代码:

this.Hide();
SplashWindowForm splashWindowForm 
= new SplashWindowForm();
splashWindowForm.Text 
= "测试工作";
System.Threading.ThreadPool.QueueUserWorkItem(
new System.Threading.WaitCallback(SplashDoWork), splashWindowForm);
splashWindowForm.ShowDialog(); 

     SplashDoWork的代码如下:

        private void SplashDoWork(object status)
        {
            SplashWindowForm splashWindowForm 
= status as SplashWindowForm;
            
try
            {
                splashWindowForm.BeginThread(
0300);
                
for (int i = 0; i < 100++i)
                {
                    splashWindowForm.SetDisplayText(
"加载启动项1.");
                    splashWindowForm.StepTo(i);
                    
if (splashWindowForm.IsAborting)
                    {
                        
return;
                    }
                    System.Threading.Thread.Sleep(
100);
                    
if (splashWindowForm.IsAborting)
                    {
                        
return;
                    }
                }
for (int i = 100; i < 200++i)
                {
                    splashWindowForm.SetDisplayText(
"加载启动项2.");
                    splashWindowForm.StepTo(i);
                    
if (splashWindowForm.IsAborting)
                    {
                        
return;
                    }
                    System.Threading.Thread.Sleep(
100);
                    
if (splashWindowForm.IsAborting)
                    {
                        
return;
                    }
                }
for (int i = 200; i < 300++i)
                {
                    splashWindowForm.SetDisplayText(
"加载启动项3.");
                    splashWindowForm.StepTo(i);
                    
if (splashWindowForm.IsAborting)
                    {
                        
return;
                    }
                    System.Threading.Thread.Sleep(
100);
                    
if (splashWindowForm.IsAborting)
                    {
                        
return;
                    }
                }
            }
            
catch (Exception exception)
            {
               MessageBox.Show(exception.Message 
+ Environment.NewLine + exception.StackTrace);
            }
            
finally
            {
                
if (splashWindowForm != null)
                {
                    splashWindowForm.End();
                }
            }
        }

   代码下载:/Files/zhjp11/ProgressWindowWithSplash.rar