[DevExpress]DevExpress控件库-MarqueeProgressBarControl控件跟ProgressBarControl控件

  1. 新建一个窗体,拖个按钮和 progressBarControl控件(Devexpress)
在按钮事件里
private void simpleButton1_Click(object sender, EventArgs e)
        {
            //设置一个最小值
            progressBarControl1.Properties.Minimum = 0;
            //设置一个最大值
            progressBarControl1.Properties.Maximum = 1000;
            //设置步长,即每次增加的数
            progressBarControl1.Properties.Step = 1;
           //设置进度条的样式
            progressBarControl1.Properties.ProgressViewStyle. = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
            progressBarControl1.Position = 0;
            for (int i = 0; i < progressBarControl1.Properties.Maximum ; i++)
            {
                //处理当前消息队列中的所有windows消息
                Application.DoEvents();
                //当前线程挂起指定的时间,这个是为了演示
                System.Threading.Thread.Sleep(12);
                //执行步长
                progressBarControl1.PerformStep();
            }
        }
总结
progressBarControl使用很方便,只需要在使用时给它一个最小值,最大值,步长
执行progressBarControl1.PerformStep();
//处理当前消息队列中的所有windows消息
                Application.DoEvents();
这样就OK 了

效果图:

代码设置:

  private void Form2_Load(object sender, EventArgs e)
        {
            //水平进度
            //最大 最小值
            progressBarControl1.Properties.Maximum = 100;
            progressBarControl1.Properties.Minimum = 0;


            progressBarControl1.Position = 0;//当前值
            progressBarControl1.Properties.ShowTitle = true;//是否显示进度数据
            //是否显示百分比
            progressBarControl1.Properties.PercentView = false;
       

        
            //垂直进度
            //最大 最小值
            progressBarControl2.Properties.Maximum = 100;
            progressBarControl2.Properties.Minimum = 0;


            progressBarControl2.Position = 0;//当前值
            progressBarControl2.Properties.ShowTitle = true;//是否显示数据
            progressBarControl1.Properties.PercentView = true;
            progressBarControl2.Properties.ProgressKind = DevExpress.XtraEditors.Controls.ProgressKind.Vertical;
            //数据显示的位置
            progressBarControl2.Properties.TextOrientation = DevExpress.Utils.Drawing.TextOrientation.Horizontal;



            marqueeProgressBarControl1.Properties.ShowTitle = true;
            marqueeProgressBarControl1.Text = "数据加载中...请稍后...";


            marqueeProgressBarControl2.Properties.ShowTitle = true;
            marqueeProgressBarControl2.Text = "数据加载中...请稍后...";
           
            marqueeProgressBarControl2.Properties.TextOrientation = DevExpress.Utils.Drawing.TextOrientation.VerticalDownwards;
        }
    

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (progressBarControl1.Position <= 100)
            {
                progressBarControl1.Position += 1;
                progressBarControl2.Position += 1;
            }
        }



你可能感兴趣的:([DevExpress]DevExpress控件库-MarqueeProgressBarControl控件跟ProgressBarControl控件)