本文整理匯總了C#中System.Windows.Forms.ProgressBar類的典型用法代碼示例。如果您正苦於以下問題:C# ProgressBar類的具體用法?C# ProgressBar怎麽用?C# ProgressBar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ProgressBar類屬於System.Windows.Forms命名空間,在下文中一共展示了ProgressBar類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.StartupPanel = new System.Windows.Forms.Panel();
this.OdeoLogo = new System.Windows.Forms.PictureBox();
this.ProgressMeter = new System.Windows.Forms.ProgressBar();
//
// StartupPanel
//
this.StartupPanel.Controls.Add(this.ProgressMeter);
this.StartupPanel.Controls.Add(this.OdeoLogo);
this.StartupPanel.Location = new System.Drawing.Point(0, 3);
this.StartupPanel.Size = new System.Drawing.Size(176, 194);
//
// OdeoLogo
//
this.OdeoLogo.Location = new System.Drawing.Point(42, 49);
this.OdeoLogo.Size = new System.Drawing.Size(92, 39);
//
// ProgressMeter
//
this.ProgressMeter.Location = new System.Drawing.Point(42, 94);
this.ProgressMeter.Size = new System.Drawing.Size(92, 6);
//
// FrmStartup
//
this.ClientSize = new System.Drawing.Size(176, 200);
this.Controls.Add(this.StartupPanel);
this.Text = "Odeo Syncr";
}
示例2: NotificationPanel
/// <summary>
/// Creates a new control instance.
/// </summary>
public NotificationPanel()
{
this.progressBar = new ProgressBar();
this.labelProgress = new Label();
this.pictureProgress = new PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureProgress)).BeginInit();
this.SuspendLayout();
// progressBar
this.progressBar.Location = new Point(62, 40);
this.progressBar.Size = new Size(730, 16);
this.progressBar.TabIndex = 1;
this.progressBar.Visible = false;
// labelProgress
this.labelProgress.Location = new Point(62, 8);
this.labelProgress.Size = new Size(730, 29);
this.labelProgress.TabIndex = 0;
this.labelProgress.TextAlign = ContentAlignment.MiddleLeft;
// pictureProgress
this.pictureProgress.Location = new Point(8, 8);
this.pictureProgress.Size = new Size(48, 48);
this.pictureProgress.TabIndex = 3;
this.pictureProgress.TabStop = false;
// Control.
this.AutoScaleDimensions = new SizeF(6F, 13F);
this.AutoScaleMode = AutoScaleMode.Font;
this.Controls.Add(this.progressBar);
this.Controls.Add(this.labelProgress);
this.Controls.Add(this.pictureProgress);
this.MaximumSize = new Size(0, 64);
this.MinimumSize = new Size(0, 64);
this.Size = new Size(800, 64);
((System.ComponentModel.ISupportInitialize)(this.pictureProgress)).EndInit();
this.ResumeLayout(false);
}
示例3: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DlgInitProgress));
this.progressBar = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(12, 38);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(328, 24);
this.progressBar.TabIndex = 3;
//
// DlgInitProgress
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(352, 101);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.progressBar});
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DlgInitProgress";
this.ShowInTaskbar = false;
this.Text = "Initializing New Language. Please Wait...";
this.ResumeLayout(false);
}
示例4: FrmLogin_Load
private void FrmLogin_Load(object sender, EventArgs e)
{
Image img = CKGen.Properties.Resources.link;
Bitmap myBitmap = new Bitmap(img);
Icon myIcon = Icon.FromHandle(myBitmap.GetHicon());
this.Icon = myIcon;
this.bar = new ProgressBar();
this.bar.Location = new System.Drawing.Point(18, 0);
this.bar.Size = new System.Drawing.Size(367, 10);
this.bar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
this.bar.Visible = false;
this.Controls.Add(bar);
this.cbServerType.DataSource = typeof(DatabaseType).ToList();
this.cbServerType.DisplayMember = "Value";
this.cbServerType.ValueMember = "Key";
this.btnOK.Enabled = false;
var connList = ConnectionSetting.GetList();
if (connList != null && connList.Count > 0)
{
cbServerName.DataSource = connList;
cbServerName.DisplayMember = "ServerName";
cbServerName.ValueMember = "ServerName";
ShowServer(connList[0].ServerName);
}
this.AcceptButton = this.btnLogin;
}
示例5: SetProgressBarState
public static void SetProgressBarState(ProgressBar progressBar, int state)
{
if (progressBar == null)
throw new ArgumentNullException("progressBar");
SendMessage(new HandleRef(progressBar, progressBar.Handle), NativeMethods.PBM_SETSTATE, (IntPtr)state, IntPtr.Zero);
}
示例6: DownloadFile
//下載網絡文件
/// <summary>
/// 下載網絡文件 帶進度條
/// </summary>
/// <param name="URL"></param>
/// <param name="fileName"></param>
/// <param name="progressBar1"></param>
/// <returns></returns>
public static bool DownloadFile(string URL, string fileName,ProgressBar progressBar1)
{
try
{
System.Net.HttpWebRequest httpWebRequest1 = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(URL);
System.Net.HttpWebResponse httpWebResponse1 = (System.Net.HttpWebResponse)httpWebRequest1.GetResponse();
long totalLength = httpWebResponse1.ContentLength;
progressBar1.Maximum = (int)totalLength;
System.IO.Stream stream1 = httpWebResponse1.GetResponseStream();
System.IO.Stream stream2 = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
long currentLength = 0;
byte[] by = new byte[1024];
int osize = stream1.Read(by, 0, (int)by.Length);
while (osize > 0)
{
currentLength = osize + currentLength;
stream2.Write(by, 0, osize);
progressBar1.Value = (int)currentLength;
osize = stream1.Read(by, 0, (int)by.Length);
}
stream2.Close();
stream1.Close();
return (currentLength == totalLength);
}
catch
{
return false;
}
}
示例7: checkClip
private void checkClip(ProgressBar pb)
{
if (pb.ForeColor == SystemColors.ActiveCaption && pb.Value >= pb.Maximum)
pb.ForeColor = Color.FromArgb(255, 0, 0);
else if(pb.ForeColor == Color.FromArgb(255, 0, 0))
pb.ForeColor = SystemColors.ActiveCaption;
}
示例8: UpdateForm
public UpdateForm()
{
this.StartPosition = FormStartPosition.CenterScreen;
this.ClientSize = new Size(220, 90);
this.FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.ControlBox = false;
this.ShowInTaskbar = false;
this.Controls.Add(l_Info = new Label());
l_Info.Location = new Point(0, 0);
l_Info.Size = new Size(220, 60);
l_Info.TextAlign = ContentAlignment.MiddleCenter;
l_Info.Font = new Font(l_Info.Font.ToString(), 10f);
ProgressBar p_Status;
this.Controls.Add(p_Status = new ProgressBar());
p_Status.Location = new Point(10, 60);
p_Status.Size = new Size(200, 20);
p_Status.Style = ProgressBarStyle.Marquee;
t_Work = new Thread(AppUpdate);
t_Work.Start();
}
示例9: CombinFile
/// <summary>
/// �ϲ��ļ�
/// </summary>
/// <param name="list">Ҫ�ϲ����ļ�����</param>
/// <param name="strPath">�ϲ�����ļ�����</param>
/// <param name="PBar">��������ʾ</param>
public void CombinFile(string[] strFile, string strPath, ProgressBar PBar)
{
PBar.Maximum = strFile.Length;
FileStream AddStream = null;
//�Ժϲ�����ļ����ƺʹ�ʽ����������ʼ��FileStream�ļ���
AddStream = new FileStream(strPath, FileMode.Append);
//��FileStream�ļ�������ʼ��BinaryWriter��д���������Ժϲ��ָ���ļ�
BinaryWriter AddWriter = new BinaryWriter(AddStream);
FileStream TempStream = null;
BinaryReader TempReader = null;
//ѭ���ϲ�С�ļ��������ɺϲ��ļ�
for (int i = 0; i < strFile.Length; i++)
{
//��С�ļ�����Ӧ���ļ����ƺʹ�ģʽ����ʼ��FileStream�ļ��������ȡ�ָ�����
TempStream = new FileStream(strFile[i].ToString(), FileMode.Open);
TempReader = new BinaryReader(TempStream);
//��ȡ�ָ��ļ��е����ݣ������ɺϲ����ļ�
AddWriter.Write(TempReader.ReadBytes((int)TempStream.Length));
//�ر�BinaryReader�ļ��Ķ���
TempReader.Close();
//�ر�FileStream�ļ���
TempStream.Close();
PBar.Value = i + 1;
}
//�ر�BinaryWriter�ļ���д��
AddWriter.Close();
//�ر�FileStream�ļ���
AddStream.Close();
MessageBox.Show("�ļ��ϲ��ɹ���");
}
示例10: collision
private void collision(PictureBox player, PictureBox weapon, ProgressBar health, System.Windows.Forms.Timer timer)
{
if (weapon.Left > this.Size.Width || weapon.Right < 0)
{
timer.Enabled = false;
weapon.Visible = false;
}
else if ((((weapon.Name == "spear") && (weapon.Right > player.Left + 15 ))
|| ((weapon.Name == "fez") && (weapon.Left < player.Right - 15)))
&& (weapon.Bottom > player.Top + 5)
&& (weapon.Top < player.Bottom - 5))
{
timer.Enabled = false;
weapon.Visible = false;
health.Value -= 25;
if (health.Value == 0)
{
disableTimers(false);
stopSound();
playSound(health.Tag.ToString());
leonidas.Location = new Point(leonidas.Location.X, leonidas.Location.Y);
MessageBox.Show(weapon.Tag + " wins!");
this.Close();
}
}
}
示例11: EasyMYPProgressBarVisibilityEvent
public EasyMYPProgressBarVisibilityEvent(ProgressBar pb, bool visible, int maximum, int value)
{
this.pb = pb;
this.visible = visible;
this.maximum = maximum;
this.value = value;
}
示例12: Display
public void Display()
{
if (Fuben != null && Fuben.Tasks != null)
{
if (this.listViewEx1.Items.Count == 0)
{
for (int i = 0; i < Fuben.Tasks.Count; i++)
{
var item = Fuben.Tasks[i];
var lvi = listViewEx1.Items.Add(item.Name);
lvi.SubItems.Add("");
lvi.SubItems.Add(item.ColdDownDisplay);
ProgressBar pb = new ProgressBar();
pb.Maximum = item.SumCount;
pb.Value = item.Count;
listViewEx1.AddEmbeddedControl(pb, 1, i);
}
}
else
{
for (int i = 0; i < Fuben.Tasks.Count; i++)
{
var item = Fuben.Tasks[i];
var lvi = listViewEx1.Items[i];
lvi.SubItems[0].Text = item.Name;
lvi.SubItems[2].Text = item.ColdDownDisplay;
ProgressBar pb = (ProgressBar)listViewEx1.GetEmbeddedControl(1, i);
if (pb.Value != item.Count) pb.Value = item.Count;
}
}
}
}
示例13: InitializeComponent
private void InitializeComponent()
{
this.label1 = new Label();
this.progressBar = new ProgressBar();
this.SuspendLayout();
this.label1.Location = new Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new Size(105, 20);
this.label1.TabIndex = 0;
this.label1.Text = "Connecting...";
this.label1.TextAlign = ContentAlignment.MiddleLeft;
this.progressBar.Location = new Point(16, 40);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new Size(236, 16);
this.progressBar.Style = ProgressBarStyle.Marquee;
this.progressBar.TabIndex = 1;
this.AutoScaleDimensions = new SizeF(6f, 13f);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new Size(271, 69);
this.ControlBox = false;
this.Controls.Add((Control) this.progressBar);
this.Controls.Add((Control) this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProviderHelperForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = FormStartPosition.CenterParent;
this.Text = "ProviderHelperForm";
this.ResumeLayout(false);
}
示例14: InitializeComponent
private void InitializeComponent()
{
this.lbCaption = new System.Windows.Forms.Label();
this.pbProgress = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// lbCaption
//
this.lbCaption.AutoSize = true;
this.lbCaption.Location = new System.Drawing.Point(3, 0);
this.lbCaption.Name = "lbCaption";
this.lbCaption.Size = new System.Drawing.Size(51, 13);
this.lbCaption.TabIndex = 0;
this.lbCaption.Text = "lbCaption";
//
// pbProgress
//
this.pbProgress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.pbProgress.Location = new System.Drawing.Point(3, 16);
this.pbProgress.Name = "pbProgress";
this.pbProgress.Size = new System.Drawing.Size(154, 23);
this.pbProgress.TabIndex = 1;
//
// ProgressControl
//
this.AutoSize = true;
this.Controls.Add(this.pbProgress);
this.Controls.Add(this.lbCaption);
this.Name = "ProgressControl";
this.Size = new System.Drawing.Size(160, 42);
this.ResumeLayout(false);
this.PerformLayout();
}
示例15: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.PBar = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// Description
//
this.Description.Name = "Description";
this.Description.Text = "The wizard has finished collecting information and is now ready to update your sy" +
"stem. Press Next to continue.";
//
// PBar
//
this.PBar.Location = new System.Drawing.Point(40, 200);
this.PBar.Maximum = 7;
this.PBar.Name = "PBar";
this.PBar.Size = new System.Drawing.Size(392, 23);
this.PBar.Step = 1;
this.PBar.TabIndex = 2;
//
// S5_Install
//
this.Controls.Add(this.PBar);
this.Name = "S5_Install";
this.NextStep = "Finish";
this.PreviousStep = "S4_Modules";
this.StepDescription = "The wizard has finished collecting information and is now ready to update your sy" +
"stem. Press Next to continue.";
this.StepTitle = "Install";
this.ValidateStep += new System.ComponentModel.CancelEventHandler(this.S5_Install_ValidateStep);
this.Controls.SetChildIndex(this.Description, 0);
this.Controls.SetChildIndex(this.PBar, 0);
this.ResumeLayout(false);
}