[DevExpress] XtraInputBox, XtraInputBoxArgs, XtraInputBoxForm 사용예시

안녕하세요.
WINFORM 개발시 간단한 입력값을 받으려고 팝업폼처럼 조그만한 Form을 새로 만들때가 있는데 궂이 그렇게 할 필요가 없습니다.

DevExpress의 XtraInputBox를 이용하여 MessageBox.show()처럼 띄우가 간단한 입력값을 받아 처리하면 되거든요.

간단하게 샘플을 아래에 적어두기 필요하신 분들이 요긴하게 쓰셨으면 좋겠습니다.

# XtraInputBox 사용 샘플
//--> XtraMessageBox와 유사하게 간단히 입력창(Prompt)을 띄어 값을 입력받을 수 있다.

 if (XtraInputBox.Show("관리자 암호를 입력해 주십시요!", "관리자 확인", "") == "1234")
     {
           FormSettings frm = new FormSettings();
           frm.ShowDialog();
     }

# XtraInputBoxArgs 사용예시

        /// <summary>
        /// 값입력 받기
        /// </summary>
      private string ShowPasswdPrompt()
      {
            XtraInputBoxArgs args = new XtraInputBoxArgs();
            args.Caption = "관리자 확인";
            args.Prompt = "관리자 암호를 입력해 주십시요!";
            args.DefaultButtonIndex = 0;

            TextEdit editor = new TextEdit();
            editor.Properties.PasswordChar = '*';
            editor.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            args.Editor = editor;
            args.DefaultResponse = string.Empty;
            string result;
            try
            {
                result = XtraInputBox.Show(args).ToString();
            }
            catch (Exception)
            {
                result = string.Empty;
            }
            return result;
        }

# XtraInputBoxForm 사용예시

            XtraInputBoxForm frm = new XtraInputBoxForm();
            XtraInputBoxArgs args = new XtraInputBoxArgs(null, null, "내용", "제목", "AAA", new DialogResult[] { DialogResult.Yes, DialogResult.Retry, DialogResult.Ignore }, 0, DevExpress.Utils.DefaultBoolean.Default, MessageBeepSound.None);
            frm.ShowInputBoxDialog(args);           
            switch (frm.DialogResult)
            {
                case DialogResult.Yes:
                    XtraMessageBox.Show("Yes");
                    break;
                case DialogResult.Cancel:
                    XtraMessageBox.Show("Cancel");
                    break;
                case DialogResult.No:
                    XtraMessageBox.Show("No");
                    break;
                case DialogResult.Retry:
                    XtraMessageBox.Show("Retry");
                    break;
                case DialogResult.Ignore:
                    XtraMessageBox.Show("Ignore");
                    break;
            }
            if (frm.InputResult != null)
                XtraMessageBox.Show(frm.InputResult.ToString());
            else
                XtraMessageBox.Show("오류");

Tag: #DevExpress #XtraInputBox #XtraInputBoxArgs #XtraInputBoxForm #XtraInput #PROMPT #프롬프트

감사합니다.

댓글

이 블로그의 인기 게시물

[구매팁] SQL SERVER 구매, 라이선스 구입은 어떻게 할까요?

[솔직 후기] 제네시스 마스터 해머링 6과 아크7 색소폰 후기와 소감

[SQLite] DB생성후 나중에 Primary Key ADD 하기