書式プロパティを使用して、コントロールが編集モードではなく、Value が null ではない (VB では Nothing) のときに表示するために Value を書式設定します。書式は、編集部分に入った日付を解析するためにも使用されます。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports Infragistics.Win.UltraWinSchedule.CalendarCombo Private Sub SetLongDateFormat() ' If the DateTimeFormatInfo property is set, prompt the user If (Not Me.ultraCalendarCombo1.DateTimeFormatInfo Is Nothing) Then Dim info As String = String.Empty info += "A custom DateTimeFormat has been specified for the control." + vbCrLf info += "Do you still want to apply the current culture's LongDatePattern?" Dim result As DialogResult = MessageBox.Show(info, "SetLongDateFormat", MessageBoxButtons.OK) If (result = DialogResult.No) Then Return End If ' Get the current culture's LongDatePattern Dim longDate As String = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern ' Set the control's Format property to the long date format string Me.ultraCalendarCombo1.Format = longDate End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using Infragistics.Win.UltraWinSchedule.CalendarCombo; private void SetLongDateFormat() { // If the DateTimeFormatInfo property is set, prompt the user if ( this.ultraCalendarCombo1.DateTimeFormatInfo != null ) { string info = string.Empty; info += "A custom DateTimeFormat has been specified for the control." + "\n"; info += "Do you still want to apply the current culture's LongDatePattern?"; DialogResult result = MessageBox.Show( info, "SetLongDateFormat", MessageBoxButtons.OK ); if ( result == DialogResult.No ) return; } // Get the current culture's LongDatePattern string longDate = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern; // Set the control's Format property to the long date format string this.ultraCalendarCombo1.Format = longDate; }