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