• 大小: 42KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-13
  • 语言: C#
  • 标签: 进度条  C#  

资源简介

采用进度条主界面,可详细反应主界面每一步加载情况(主要采用委托以及线程)

资源截图

代码片段和文件信息

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

namespace frmLoading
{

    public delegate void ShowLoadMsg(string msg int ipos);
    public partial class Form1 : Form
    {
        public Form1()
        {
            Thread th = new Thread(new ThreadStart(FormLoading));
            th.Start();
            Init(); 
            
        }
        #region  进度条初始化信息
        public static event ShowLoadMsg LoadingMsg;
        public static bool frmLoadingOpen = false;
        /// 
        /// 打开进度条界面
        /// 

        private void FormLoading()
        {
            Form2 frmloading;
            frmloading = new Form2();
            frmloading.ShowDialog();
        }
        /// 
        /// 初始化信息
        /// 

        private void Init()
        {
            while (!frmLoadingOpen)
            {
                Thread.Sleep(10);
            }
            LoadingMsg(“正在加载界面....“ 1);
            InitializeComponent();            
            LoadingMsg(“正在初始化串口....“ 10);
            int i = 0;
            while (i < 9)
            {
                i++;
                LoadingMsg(“正在初始化串口“ + i.ToString() + “....“ 10 * i);
                Thread.Sleep(1000);

            }
            LoadingMsg(“加载完成....“ 100);
            while (frmLoadingOpen)
            {

            }
        }

        #endregion
    }
}

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

     文件      10240  2011-08-01 16:27  LoadDemo\LoadDemo\bin\Debug\frmLoading.exe

     文件      30208  2011-08-01 16:27  LoadDemo\LoadDemo\bin\Debug\frmLoading.pdb

     文件      14328  2011-08-01 16:27  LoadDemo\LoadDemo\bin\Debug\frmLoading.vshost.exe

     文件        490  2007-07-21 01:33  LoadDemo\LoadDemo\bin\Debug\frmLoading.vshost.exe.manifest

     文件       1693  2011-08-01 16:27  LoadDemo\LoadDemo\Form1.cs

     文件       1484  2011-08-01 16:27  LoadDemo\LoadDemo\Form1.Designer.cs

     文件       5814  2011-08-01 16:27  LoadDemo\LoadDemo\Form1.resx

     文件       1388  2011-08-01 16:27  LoadDemo\LoadDemo\Form2.cs

     文件       2843  2011-08-01 16:27  LoadDemo\LoadDemo\Form2.Designer.cs

     文件       5814  2011-08-01 16:27  LoadDemo\LoadDemo\Form2.resx

     文件       4035  2011-08-01 16:27  LoadDemo\LoadDemo\LoadDemo.csproj

     文件      10240  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\frmLoading.exe

     文件        180  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\frmLoading.Form1.resources

     文件        180  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\frmLoading.Form2.resources

     文件      30208  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\frmLoading.pdb

     文件        180  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\frmLoading.Properties.Resources.resources

     文件        640  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\LoadDemo.csproj.FileListAbsolute.txt

     文件        905  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug\LoadDemo.csproj.GenerateResource.Cache

     文件        491  2011-08-01 16:17  LoadDemo\LoadDemo\Program.cs

     文件       1376  2011-08-01 16:17  LoadDemo\LoadDemo\Properties\AssemblyInfo.cs

     文件       2870  2011-08-01 16:17  LoadDemo\LoadDemo\Properties\Resources.Designer.cs

     文件       5612  2011-08-01 16:17  LoadDemo\LoadDemo\Properties\Resources.resx

     文件       1095  2011-08-01 16:17  LoadDemo\LoadDemo\Properties\Settings.Designer.cs

     文件        249  2011-08-01 16:17  LoadDemo\LoadDemo\Properties\Settings.settings

     文件        914  2011-08-01 16:27  LoadDemo\LoadDemo.sln

    ..A..H.     16896  2011-08-01 16:27  LoadDemo\LoadDemo.suo

     目录          0  2011-08-01 16:23  LoadDemo\LoadDemo\obj\Debug\Refactor

     目录          0  2011-08-01 16:17  LoadDemo\LoadDemo\obj\Debug\TempPE

     目录          0  2011-08-01 16:27  LoadDemo\LoadDemo\bin\Debug

     目录          0  2011-08-01 16:27  LoadDemo\LoadDemo\obj\Debug

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

评论

共有 条评论