⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progress.cs

📁 用C#开发的录井油气识别专家系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace expert
{
	/// <summary>
	/// progress 的摘要说明。
	/// </summary>
	public class progress : System.Windows.Forms.Form
	{
		public System.Windows.Forms.ProgressBar progressBar1;
		private System.Windows.Forms.Button cancel;
		public bool bCancel;
		public DateTime begin;
		public DateTime end;
		private System.Windows.Forms.Label labeltime;
		
		
		
		private System.Windows.Forms.Label labelgeneration;
	
		public int generationsPerSample;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public progress()
		{
			bCancel=false;
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.progressBar1 = new System.Windows.Forms.ProgressBar();
			this.cancel = new System.Windows.Forms.Button();
			this.labeltime = new System.Windows.Forms.Label();
			this.labelgeneration = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// progressBar1
			// 
			this.progressBar1.Location = new System.Drawing.Point(32, 16);
			this.progressBar1.Name = "progressBar1";
			this.progressBar1.Size = new System.Drawing.Size(720, 32);
			this.progressBar1.Step = 1;
			this.progressBar1.TabIndex = 0;
			// 
			// cancel
			// 
			this.cancel.Location = new System.Drawing.Point(784, 32);
			this.cancel.Name = "cancel";
			this.cancel.Size = new System.Drawing.Size(120, 32);
			this.cancel.TabIndex = 1;
			this.cancel.Text = "终止学习";
			this.cancel.Click += new System.EventHandler(this.cancel_Click);
			// 
			// labeltime
			// 
			this.labeltime.Location = new System.Drawing.Point(56, 64);
			this.labeltime.Name = "labeltime";
			this.labeltime.Size = new System.Drawing.Size(328, 24);
			this.labeltime.TabIndex = 2;
			this.labeltime.Text = "label1";
			// 
			// labelgeneration
			// 
			this.labelgeneration.Location = new System.Drawing.Point(448, 64);
			this.labelgeneration.Name = "labelgeneration";
			this.labelgeneration.Size = new System.Drawing.Size(280, 23);
			this.labelgeneration.TabIndex = 0;
			this.labelgeneration.Text = "label2";
			// 
			// progress
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(8, 18);
			this.ClientSize = new System.Drawing.Size(928, 104);
			this.Controls.Add(this.labelgeneration);
			this.Controls.Add(this.labeltime);
			this.Controls.Add(this.cancel);
			this.Controls.Add(this.progressBar1);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "progress";
			this.Text = "正在对标准样品进行学习";
			this.ResumeLayout(false);

		}
		#endregion

		private void cancel_Click(object sender, System.EventArgs e)
		{
			bCancel=true;
		}


		public void EstimateTime()
		{
			TimeSpan span=DateTime.Now-begin;
			double secondspergeneration=span.TotalSeconds/progressBar1.Value;
			double secondsremain=secondspergeneration*(progressBar1.Maximum-progressBar1.Value);
			TimeSpan timeRemain=new TimeSpan(0,0,(int)secondsremain);
			this.labeltime.Text="估计剩余时间:"+timeRemain.ToString();
			this.labelgeneration.Text="总世代数"+Convert.ToString(progressBar1.Maximum)+
										"当前第"+Convert.ToString(progressBar1.Value)+"世代";


		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -