C#进度条怎么用 / C#progressBar的用法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C#进度条怎么用 / C#progressBar的用法相关的知识,希望对你有一定的参考价值。

参考技术A 创建进度条窗口2、在其他窗口中调用方法ShowProcess(int percent,string message)

复制代码 代码如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Mes.Core;

namespace HCMDoImport

public partial class ProcessBarForm : BaseForm

int processPercent = 0;
string message = "";
public string Message

get return message;
set

message = value;
this.label1.Text = message;


public int ProcessPercent

get return processPercent;
set

processPercent = value;
if (processPercent >= 100)
this.Close();
this.progressBar1.Value = processPercent;



public ProcessBarForm()

InitializeComponent();

/// <summary>
/// 更新进度
/// </summary>
/// <param name="percent">进度,小于等于100</param>
/// <param name="message">消息</param>
public void ShowProcess(int percent,string message)

this.Show();
this.ProcessPercent = percent;
this.Message = message;
this.progressBar1.Refresh();
this.label1.Refresh();

private void ProcessBarForm_Load(object sender, EventArgs e)

this.Cursor = Cursors.WaitCursor;

private void ProcessBarForm_FormClosing(object sender, FormClosingEventArgs e)

this.Cursor = Cursors.Default;



可以参考:http://jingyan.baidu.com/article/f0e83a25a4a5ac22e59101f5.html

以上是关于C#进度条怎么用 / C#progressBar的用法的主要内容,如果未能解决你的问题,请参考以下文章

<progress></progress>标签怎么做带百分比的进度条

重写C# winform 进度条的样式(要代码示例)

C#中怎样改变进度条(progressbar)的颜色?

微信小程序 progress 进度条 内部圆角及内部条渐变色

移动端物流进度条前端开发怎么做

vue进度条插件都有哪些?