demo 的实现图

下边是步骤和代码

1定义 时钟事件,定时的增加进度条的增量.

2:  添加进度条

3;定义字段属性

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Forms; namespace ProgressBar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
jindu = new JinduModel();
jindu.jindu = ;
rarlist = new BindingList<JinduModel>();
rarlist.Add(jindu);
gridControl1.DataSource = rarlist;
InitGridcontrol();
}
JinduModel jindu;
// BindingSource bs;
BindingList<JinduModel> rarlist;
void InitGridcontrol()
{ // new System.Timers.Timer
//实例化Timer类,设置间隔时间为10000毫秒;
aTimer = new System.Timers.Timer();
//注册计时器的事件
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
//设置时间间隔为2秒(2000毫秒),覆盖构造函数设置的间隔
aTimer.Interval = ;
//设置是执行一次(false)还是一直执行(true),默认为true
aTimer.AutoReset = true;
//开始计时
aTimer.Enabled = true; }
//指定Timer触发的事件
private void OnTimedEvent(object source, ElapsedEventArgs e)
{
this.Invoke( new Action(()=> jindu.jindu++));
Console.WriteLine("触发的事件发生在: {0}", e.SignalTime);
}
//Timer不要声明成局部变量,否则会被GC回收
private static System.Timers.Timer aTimer;
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
if (e.Column.FieldName == "count")
{
int count = ;//Convert.ToInt32(System.Math.Ceiling(zipfileInfo.Length / 1024.0));//datalist[0].count;//(int)this.gridView1.GetRowCellValue(e.RowHandle, "Count");
int index = (int)e.CellValue;
e.DisplayText = string.Format("{0}/{1}", index, count);
}
} private void gridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
{
if (e.Column.FieldName == "count")
{
// int count = (int)this.gridView1.GetRowCellValue(e.RowHandle, "count");
// int index = (int)e.CellValue;
repositoryItemProgressBar1.Maximum = ;//Convert.ToInt32(System.Math.Ceiling(zipfileInfo.Length / 1024.0));//datalist[0].count;//count;
e.RepositoryItem = repositoryItemProgressBar1;
}
}
} }
 class JinduModel : INotifyPropertyChanged
{
private int _jindu;
public int jindu
{
get { return _jindu; }
set { _jindu = value; OnPropertyChanged("jindu"); }
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } }

最新文章

  1. 使用css3做钟表
  2. C中嵌入python
  3. mysql 触发器示例和注解
  4. Images.xcassets
  5. HTML5实践 -- 使用CSS3 Media Queries实现响应式设计
  6. Microsoft.Extensions.Options支持什么样的配置类?
  7. jquery中ajax常用方法
  8. 正则表达式 ——python 基础
  9. (转)直接拿来用!最火的iOS开源项目(二)
  10. VC++制作DLL具体解释
  11. int*-------int
  12. 重装eclipse要做的事
  13. ASP.NET DataList绑定数据并实现分页
  14. ubuntu中在线升级python
  15. 再谈DOMContentLoaded与渲染阻塞—分析html页面事件与资源加载
  16. VSFTP 配置虚拟用户
  17. java持有对象【2】ArrayList容器续解
  18. Subversion detected an unsupported working copy version
  19. (原创)OpenStack服务如何使用Keystone(一)---Keystone端的操作
  20. java验证码工具

热门文章

  1. semver 版本号命名法
  2. Structs复习 Structs标签
  3. Hibernate学习笔记1.2(Annotation版本的Helloworld)
  4. window document树
  5. python 删除模块
  6. 我的第一篇博客之js的XXXX年XX月XX日 星期[日一-六] [上下]午 XX时:XX分
  7. mysql5.7.10开启慢查询
  8. java.net.UnknownHostException: www.terracotta.org
  9. 【转】修复关于apache-xampp的问题:Port 443 in use by “vmware-hostd.exe”!
  10. pta l2-14(列车调度)