UltraDayView コントロールには、メインの横に、追加のタイムゾーンのタイム スロットを表示する Infragistics.Win.UltraWinSchedule.DayView.TimeSlotDescriptorAreaUIElement をもう 1 つ表示できます。AdditionalTimeZoneUtcOffset プロパティは、TimeSlotDescriptorAreaUIElement によって表示されるタイムゾーンを決定します。
注: Office2003 の表示スタイルを有効にするには、この UltraDayView コントロールに関連付けられた UltraCalendarLook オブジェクトの ViewStyle プロパティを DefaultableBoolean.True に設定します。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Get a list of the time zones in this computer's registry Dim timeZoneList As ArrayList = Infragistics.Win.Utilities.GetTimeZones() ' Obtain a reference to the TimeZoneInfo object that represents ' the "Pacific Standard Time" time zone Dim tzi As TimeZoneInfo = Nothing Dim tziTemp As TimeZoneInfo = Nothing For Each tziTemp In timeZoneList If tziTemp.StandardName = "Pacific Standard Time" Then tzi = tziTemp Exit For End If Next ' If we could not get the TimeZoneInfo object for Pacific ' Standard Time, return If tzi Is Nothing Then Return ' Set the AdditionalTimeZoneUtcOffset property of the ' UltraDayView control to the UtcOffset property of ' the TimeZoneInfo object we obtained above Me.UltraDayView1.AdditionalTimeZoneUtcOffset = tzi.UtcOffset ' Set the AdditionalTimeZoneLabel property of the ' UltraDayView control to the acronym for the standard ' name of the TimeZoneInfo object we obtained above Me.UltraDayView1.AdditionalTimeZoneLabel = Me.GetAcronym(tzi.StandardName) ' Set the CurrentTimeZoneLabel property of the ' UltraDayView control to the acronym for the current ' time zone's StandardName Me.UltraDayView1.CurrentTimeZoneLabel = Me.GetAcronym(TimeZone.CurrentTimeZone.StandardName) ' Set the AdditionalTimeZoneVisible property of the ' UltraDayView control to true Me.UltraDayView1.AdditionalTimeZoneVisible = True End Sub ' Returns the acronym for the specified string, or an empty ' string if there are no spaces in the specified string Private Function GetAcronym(ByVal text As String) As String If text Is Nothing Or text.Length = 0 Then Return String.Empty ' Split the string on every space character Dim splitChar As String = " " Dim words As String() = text.Split(splitChar.ToCharArray()) ' Iterate the array of substrings, and accumulate ' the first character of each one Dim retVal As String = String.Empty Dim i As Integer For i = 0 To words.GetLength(0) - 1 retVal += words(i).Substring(0, 1) Next ' Make the result uppercase, and return it Return retVal.ToUpper() End Function
using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void button1_Click(object sender, System.EventArgs e) { // Get a list of the time zones in this computer's registry ArrayList timeZoneList = Infragistics.Win.Utilities.GetTimeZones(); // Obtain a reference to the TimeZoneInfo object that represents // the "Pacific Standard Time" time zone TimeZoneInfo tzi = null; foreach( TimeZoneInfo tziTemp in timeZoneList ) { if ( tziTemp.StandardName == "Pacific Standard Time" ) { tzi = tziTemp; break; } } // If we could not get the TimeZoneInfo object for Pacific // Standard Time, return if ( tzi == null ) return; // Set the AdditionalTimeZoneUtcOffset property of the // UltraDayView control to the UtcOffset property of // the TimeZoneInfo object we obtained above this.ultraDayView1.AdditionalTimeZoneUtcOffset = tzi.UtcOffset; // Set the AdditionalTimeZoneLabel property of the // UltraDayView control to the acronym for the standard // name of the TimeZoneInfo object we obtained above this.ultraDayView1.AdditionalTimeZoneLabel = this.GetAcronym( tzi.StandardName ); // Set the CurrentTimeZoneLabel property of the // UltraDayView control to the acronym for the current // time zone's StandardName this.ultraDayView1.CurrentTimeZoneLabel = this.GetAcronym( TimeZone.CurrentTimeZone.StandardName ); // Set the AdditionalTimeZoneVisible property of the // UltraDayView control to true this.ultraDayView1.AdditionalTimeZoneVisible = true; } // Returns the acronym for the specified string, or an empty // string if there are no spaces in the specified string private string GetAcronym( string text ) { if ( text == null || text.Length == 0 ) return string.Empty; // Split the string on every space character char[] splitChar = new Char[1]; splitChar[0] = ' '; string[] words = text.Split( splitChar ); // Iterate the array of substrings, and accumulate // the first character of each one string retVal = string.Empty; for( int i = 0; i < words.GetLength(0); i ++ ) { retVal += words[i].Substring( 0, 1 ); } // Make the result uppercase, and return it return retVal.ToUpper(); }