zoukankan      html  css  js  c++  java
  • 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;
  • 相关阅读:
    梯度方向问题
    switchsharp
    R语言学习笔记:sort、rank、order、arrange排序函数
    R语言学习笔记:choose、factorial、combn排列组合函数
    MySQL学习笔记:少用Null
    Oracle学习笔记:11g服务介绍及哪些服务必须开启?
    GreenPlum学习笔记:create or replace function创建函数
    Python学习笔记:出生日期转化为年龄
    Python学习笔记:import sys模块(argv、path、platform、exit)
    Oracle学习笔记:wm_concat函数合并字段
  • 原文地址:https://www.cnblogs.com/springsnow/p/10298705.html
Copyright © 2011-2022 走看看