processbar 与 RepositoryItemProgressBar 使用


1.processbar例子

public partial class DlgProgressBar : DevExpress.XtraEditors.XtraForm
    {
        public DlgProgressBar( int BarMaxValue, int BarMinValue)
        {
            InitializeComponent();

            // 设置一个最小值
            progressBarControl1.Properties.Minimum = BarMaxValue;
            // 设置一个最大值
            progressBarControl1.Properties.Maximum = BarMinValue;
            // 设置步长,即每次增加的数
            progressBarControl1.Properties.Step = 1;

           // progressBarControl1.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
            progressBarControl1.Position = 0;
        }
        public void SetBarValue( string msgString, int barValue)
        {
            for ( int i = 0; i < barValue; i++)
            {
                Application.DoEvents();
                progressBarControl1.PerformStep();
                this.lblMsg.Text = msgString+ " ... ";
                System.Threading.Thread.Sleep( 15);

            }
            if (barValue == 0)
            {

                Application.DoEvents();
                this.lblMsg.Text = msgString + " ... ";
                System.Threading.Thread.Sleep( 15);
            }

        }
    
    }

 

 

2.RepositoryItemProgressBar

 

  private  void ShowMsg(DevExpress.XtraBars.BarEditItem item,  string msgString)
        {
             if ( this.InvokeRequired ==  true)
            {
                 this.Invoke((MethodInvoker) delegate { item.EditValue = msgString; });
            }
             else
            {
                item.Caption = msgString;
            }


        }
 
下面开始调用
int processCurrent=0;
processCurrent++;
  ShowMsg(pssbState, processCurrent.ToString());

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM