첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.01MB

▶ MainForm.cs

using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;

using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : Form
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            this.progressBarControl.Properties.ShowTitle       = true;
            this.progressBarControl.Properties.PercentView     = false;
            this.progressBarControl.Properties.Appearance.Font = new Font("나눔고딕코딩", 12f);

            this.progressBarControl.Properties.CustomDisplayText += progressBarControl_CustomDisplayText;
            this.testButton.Click                                += testButton_Click;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 진행바 컨트롤 커스텀 디스플레이 텍스트 설정하기 - repositoryItemProgressBar_CustomDisplayText(sender, e)

        /// <summary>
        /// 진행바 컨트롤 커스텀 디스플레이 텍스트 설정하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void progressBarControl_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
        {
            ProgressBarControl progressBarControl = sender as ProgressBarControl;

            e.DisplayText = $"{e.Value} / {progressBarControl.Properties.Maximum}";
        }

        #endregion
        #region 테스트 버튼 클릭시 처리하기 - testButton_Click(sender, e)

        /// <summary>
        /// 테스트 버튼 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void testButton_Click(object sender, EventArgs e)
        {
            this.progressBarControl.Properties.Minimum = 0;
            this.progressBarControl.Properties.Maximum = 100;
            this.progressBarControl.EditValue          = 0;

            for(int i = 1; i < 101; i++)
            {
                this.progressBarControl.EditValue = i;

                this.progressBarControl.Update();

                Thread.Sleep(50);
            }
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요