XtraEditors七、ProgressBarControl、MarqueeProgressBarControl、ProgressPanel控件

 

一、ProgressBarControl

进度条控件

效果如下:

示例代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;
using System.Threading;

namespace DXApplication_1
{
    public partial class ProgressBarControlForm : DevExpress.XtraEditors.XtraForm
    {
        public ProgressBarControlForm()
        {
            InitializeComponent();
        }
        private void Encapsulation_DeleteFiles()
        {
            string dirPath = "C:\\Users\\teeking_scx\\source\\repos\\DXApplication_1\\test";
            if (Directory.Exists(dirPath))
            {
                string[] fileArr = Directory.GetFiles(dirPath);
                progressBarControl1.Properties.Step = 1;
                progressBarControl1.Properties.PercentView = true;
                progressBarControl1.Properties.Maximum = fileArr.Length;
                progressBarControl1.Properties.Minimum = 0;
                Thread.Sleep(10000);
                foreach (string fileName in fileArr) {
                    File.Delete(fileName);
                    progressBarControl1.PerformStep();
                    progressBarControl1.Update();
                    Thread.Sleep(1000);
                }
            }
        }
        private void ProgressBarControl_Load(object sender, EventArgs e)
        {
            //方法一:使用Thread类
            ThreadStart threadStart = new ThreadStart(Encapsulation_DeleteFiles);//通过ThreadStart委托告诉子线程执行什么方法  
            Thread thread = new Thread(threadStart);
            thread.Start();//启动新线程
        }
    }
}

二、MarqueeProgressBarControl控件

ShowTitle表示显示文本

Text属性显示在运动时显示的文本;

其Properties属性下的MarqueeAnimationSpeed属性控制其滚动速度

如图所示:

代码如下:

marqueeProgressBarControl1.Properties.MarqueeAnimationSpeed = 100;
 marqueeProgressBarControl1.Properties.ShowTitle = true;  marqueeProgressBarControl1.Text = "Loading...";

 

三、ProgressPanel控件

该控件是用来表示任何操作的进度,

该控件包含一个动画图像两个标签

其中两个标签分别用来指定标题描述属性;

如图:

ProgressPanel 包含了许多图像,可以手动指定显示的图像格式,

通过LookAndFeel属性来设定,

示例代码:

ProgressPanel progressPanel1 = new ProgressPanel();
Controls.Add(progressPanel1);
progressPanel1.LookAndFeel.SkinName = "DevExpress Dark Style";
progressPanel1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat;
progressPanel1.LookAndFeel.UseDefaultLookAndFeel = false;

posted on 2019-01-21 14:56  springsnow  阅读(884)  评论(0编辑  收藏  举报

导航