📄 progressbar.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace WindowsApplication2
{
/// <summary>
/// A simple form that shows the user how much progress has been made
/// initializing the simulation
/// </summary>
public class ProgressBar : System.Windows.Forms.Form
{
private System.Windows.Forms.ProgressBar theBar;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public ProgressBar(int range, int step)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
theBar.Maximum = range;
theBar.Step = step;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.theBar = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// theBar
//
this.theBar.Location = new System.Drawing.Point(8, 8);
this.theBar.Name = "theBar";
this.theBar.Size = new System.Drawing.Size(288, 24);
this.theBar.TabIndex = 2;
//
// ProgressBar
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(304, 38);
this.ControlBox = false;
this.Controls.Add(this.theBar);
this.Name = "ProgressBar";
this.ShowInTaskbar = false;
this.Text = "Preparing Simulation...";
this.ResumeLayout(false);
}
#endregion
public void increment ()
{
if (theBar.Maximum - theBar.Value >= 10)
theBar.PerformStep();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -