DefaultButtonIndex - 指定哪个输入框按钮是默认按钮。 当最终用户按下Enter键时,默认按钮被视为已单击。 将此属性设置为0,使 "OK"成为默认按钮,而将“ 1”设为“Cancel”按钮。
Caption - 输入框标题。
在下图输入框显示DateEdit编辑器,下面的代码说明了如何创建这种输入框。
// initialize a new XtraInputBoxArgs instance
XtraInputBoxArgs args = new XtraInputBoxArgs();
// set required Input Box options
args.Caption = "Shipping options";
args.Prompt = "Delivery date";
args.DefaultButtonIndex = 0;
args.Showing += Args_Showing;
// initialize a DateEdit editor with custom settings
DateEdit editor = new DateEdit();
editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.TouchUI;
editor.Properties.Mask.EditMask = "MMMM d, yyyy";
args.Editor = editor;
// a default DateEdit value
args.DefaultResponse = DateTime.Now.Date.AddDays(3);
// display an Input Box with the custom editor
var result = XtraInputBox.Show(args).ToString();
// set a dialog icon
private void Args_Showing(object sender, XtraMessageShowingArgs e) {
e.Form.Icon = this.Icon;
' initialize a new XtraInputBoxArgs instance
Dim args As New XtraInputBoxArgs()
' set required Input Box options
args.Caption = "Shipping options"
args.Prompt = "Delivery date"
args.DefaultButtonIndex = 0
AddHandler args.Showing, AddressOf Args_Showing
' initialize a DateEdit editor with custom settings
Dim editor As New DateEdit()
editor.Properties.CalendarView = DevExpress.XtraEditors.Repository.CalendarView.TouchUI
editor.Properties.Mask.EditMask = "MMMM d, yyyy"
args.Editor = editor
' a default DateEdit value
args.DefaultResponse = Date.Now.Date.AddDays(3)
' display an Input Box with the custom editor
Dim result = XtraInputBox.Show(args).ToString()
Private Sub Args_Showing(ByVal sender As Object, ByVal e As XtraMessageShowingArgs)
e.Form.Icon = Me.Icon
End Sub