• 大小: 59KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-22
  • 语言: C#
  • 标签: winform  等待窗体  

资源简介

winform 等待窗体 gif动画等待

资源截图

代码片段和文件信息

using Fancky.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }



        //开始执行
        private void button1_Click(object sender EventArgs e)
        {
            //调用耗时工作同时,UI线程会阻塞,点击后面的按钮还是有效果的,只是要等待UI线程执行完耗时
            //工作才会有响应。
            //显示此等待框,只是一个假象。调用时候需要引用Fancky.Commom.dll(.net 4.5框架开发)在debug下有。源码不提供了,要源码QQ709737588
            FrmWait.ShowWaitForm(this);
            this.backgroundWorker.RunWorkerAsync();
        }

        //执行耗时任务
        private void backgroundWorker_DoWork(object sender DoWorkEventArgs e)
        {
            //一般用BeginInvoke只是显示与UI相关才用,其他地方交给线程,这点我是写demo方便,就无所谓了,希望没误导你们!
            this.BeginInvoke((MethodInvoker)(() =>
            {
                for (int i = 0; i < 1000000000; i++)
                {
                    if (this.backgroundWorker.CancellationPending)
                    {
                        break;
                    }
                }
            }));
        }

        //耗时任务完成,关闭等待窗
        private void backgroundWorker_RunWorkerCompleted(object sender RunWorkerCompletedEventArgs e)
        {
            FrmWait.CloseFrmWait();
        }

        //取消
        private void button2_Click(object sender EventArgs e)
        {
            FrmWait.CloseFrmWait();
            //this.backgroundWorker.CancelAsync();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        187  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\App.config

     文件      15360  2015-08-13 11:58  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\Fancky.Common.dll

     文件       9728  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.exe

     文件        187  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.exe.config

     文件      26112  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.pdb

     文件      22984  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.vshost.exe

     文件        187  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.vshost.exe.config

     文件        490  2014-01-13 21:31  WindowsFormsApplication4\WindowsFormsApplication4\bin\Debug\WindowsFormsApplication4.vshost.exe.manifest

     文件       2032  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs

     文件       3238  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\Form1.Designer.cs

     文件       6021  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\Form1.resx

     文件        863  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7204  2015-08-13 13:20  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1304  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.csproj.FileListAbsolute.txt

     文件        975  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.csproj.GenerateResource.Cache

     文件       7440  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.csprojResolveAssemblyReference.cache

     文件       9728  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.exe

     文件        180  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.Form1.resources

     文件      26112  2015-08-13 14:46  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.pdb

     文件        180  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\obj\Debug\WindowsFormsApplication4.Properties.Resources.resources

     文件        536  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\Program.cs

     文件       1386  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\Properties\AssemblyInfo.cs

     文件       2900  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\Properties\Resources.Designer.cs

     文件       5612  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\Properties\Resources.resx

     文件       1111  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\Properties\Settings.Designer.cs

     文件        249  2015-08-13 13:19  WindowsFormsApplication4\WindowsFormsApplication4\Properties\Settings.settings

     文件       3960  2015-08-13 13:22  WindowsFormsApplication4\WindowsFormsApplication4\WindowsFormsApplication4.csproj

............此处省略13个文件信息

评论

共有 条评论