[C#/WINFORM/DEVEXPRESS] WaitForm 클래스 : 커스텀 WAIT FORM 표시하기
■ WaitForm 클래스를 사용해 커스텀 WAIT FORM을 표시하는 방법을 보여준다. ▶ MainWaitForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
using System; using DevExpress.XtraWaitForm; namespace TestProject { /// <summary> /// 메인 대기 폼 /// </summary> public partial class MainWaitForm : WaitForm { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainWaitForm() /// <summary> /// 생성자 /// </summary> public MainWaitForm() { InitializeComponent(); this.progressPanel.AutoSize = true; } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 제목 설정하기 - SetCaption(caption) /// <summary> /// 제목 설정하기 /// </summary> /// <param name="caption"></param> public override void SetCaption(string caption) { base.SetCaption(caption); this.progressPanel.Caption = caption; } #endregion #region 설명 설정하기 - SetDescription(description) /// <summary> /// 설명 설정하기 /// </summary> /// <param name="description">설명</param> public override void SetDescription(string description) { base.SetDescription(description); this.progressPanel.Description = description; } #endregion #region 명령 처리하기 - ProcessCommand(enumeration, argument) /// <summary> /// 명령 처리하기 /// </summary> /// <param name="enumeration">열거형</param> /// <param name="argument">인자</param> public override void ProcessCommand(Enum enumeration, object argument) { base.ProcessCommand(enumeration, argument); } #endregion } } |
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
using System; using System.Threading; using System.Windows.Forms; using DevExpress.XtraSplashScreen; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Private #region Test 버튼 클릭시 처리하기 - testButton_Click(sender, e) /// <summary> /// Test 버튼 클릭시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void testButton_Click(object sender, EventArgs e) { SplashScreenManager.ShowForm(this, typeof(MainWaitForm), true, true, false); for (int i = 1; i <= 100; i++) { SplashScreenManager.Default.SetWaitFormDescription(i.ToString() + "%"); Thread.Sleep(25); } SplashScreenManager.CloseForm(false); } #endregion } } |
TestProject.zip