バージョン

EnsureDateTimeVisible(DateTime) メソッド

指定した日付と時間を表す列をコントロールの表示可能な領域に移動し、最初の列に表示します。
シンタックス
'宣言
 
Public Overloads Function EnsureDateTimeVisible( _
   ByVal dateTime As Date _
) As Boolean
public bool EnsureDateTimeVisible( 
   DateTime dateTime
)

パラメータ

dateTime
表示される日付と時刻を定義する DateTime 構造。

戻り値の型

操作の実行が成功したかどうかを示すブール値。
使用例
Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

    AddHandler Me.ultraTimeLineView1.DateNavigationButtonClicked, AddressOf Me.OnDateNavigationButtonClicked

    Private Sub OnDateNavigationButtonClicked(ByVal sender As Object, ByVal e As DateNavigationButtonClickedEventArgs)

        Dim control As UltraTimelineView = sender
        Dim timeInterval As TimeInterval = e.DateTimeInterval
        If Not timeInterval Is Nothing AndAlso _
            timeInterval.DateNavigationButtonActionResolved = TimelineViewDateNavigationButtonAction.None Then

            Dim tzi As TimeZoneInfo = timeInterval.TimeZone
            If Not tzi Is Nothing AndAlso Not TimeZoneInfo.CurrentTimeZone Is Nothing Then

                '  Get the StartDateTime from the DateRange, which will
                '  contain the local time for that TimeZone.
                Dim nextDate As DateTime = e.DateTimeRange.StartDateTime

                '  Convert the local time for that TimeZone into local time
                '  for the current time zone
                nextDate = New DateTime(nextDate.Ticks, DateTimeKind.Local)
                Dim utc As DateTime = nextDate.Add(tzi.UtcOffset)
                If (tzi.IsDaylightSavingTime(utc)) Then
                    utc = utc.Add(tzi.DaylightUtcOffset)

                    nextDate = TimeZoneInfo.CurrentTimeZone.ToLocalTime(utc, DateTimeKind.Utc)

                    '  Get the next/previous date depending on the navigation direction.
                    Dim forward As Boolean = IIf(e.NavigationDirection = DateNavigationDirection.Forward, True, False)
                    nextDate = timeInterval.GetNextDate(nextDate, forward)

                    '  Call EnsureDateTimeVisible to navigate to the date
                    control.EnsureDateTimeVisible(nextDate, forward = False)
                End If
            End If
        End If

    End Sub
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

    this.ultraTimeLineView1.DateNavigationButtonClicked += new DateNavigationButtonClickedHandler(this.OnDateNavigationButtonClicked);

    private void OnDateNavigationButtonClicked(object sender, DateNavigationButtonClickedEventArgs e)
    {
        UltraTimelineView control = sender as UltraTimelineView;
        TimeInterval timeInterval = e.DateTimeInterval as TimeInterval;
        if ( timeInterval != null &&
             timeInterval.DateNavigationButtonActionResolved == TimelineViewDateNavigationButtonAction.None )
        {
            TimeZoneInfo tzi = timeInterval.TimeZone;
            if ( tzi != null && TimeZoneInfo.CurrentTimeZone != null )
            {
                //  Get the StartDateTime from the DateRange, which will
                //  contain the local time for that TimeZone.
                DateTime next = e.DateTimeRange.StartDateTime;

                //  Convert the local time for that TimeZone into local time
                //  for the current time zone
                next = new DateTime( next.Ticks, DateTimeKind.Local );
                DateTime utc = next.Add( tzi.UtcOffset );
                if ( tzi.IsDaylightSavingTime(utc) )
                    utc = utc.Add( tzi.DaylightUtcOffset );

                next = TimeZoneInfo.CurrentTimeZone.ToLocalTime( utc, DateTimeKind.Utc );
                
                //  Get the next/previous date depending on the navigation direction.
                bool forward = e.NavigationDirection == DateNavigationDirection.Forward;
                next = timeInterval.GetNextDate( next, forward );

                //  Call EnsureDateTimeVisible to navigate to the date
                control.EnsureDateTimeVisible( next, forward == false );
            }

        }
    }
参照