バージョン

LogicalDayOffset プロパティ

1日の開始時刻の、午前0時からのオフセットを取得または設定します。
シンタックス
'宣言
 
Public Property LogicalDayOffset As TimeSpan
public TimeSpan LogicalDayOffset {get; set;}
解説

1日は通常,午前0時0分に始まります。アプリケーションによっては、午前0時0分以外の時刻を1日の始まりと見なす方がよい場合があります。LogicalDayOffsetプロパティはこのために使用します。

このプロパティの値は DateTime 構造体の Add メソッドを使用して (プロパティが適用される DateTime 構造体に) 追加されます。

LogicalDayOffsetプロパティの絶対値は、オフセットが丸1日を超えないように、23時間59分以下にする必要があります。プロパティをこの範囲を超える値を設定すると、例外がスローされます。UltraCalendarInfo コンポーネントの時刻に関する精度が 1 分に制限されているため、秒コンポーネントを含む値にプロパティを設定すると秒コンポーネントが削除されます。たとえば、プロパティが 14 分 59 秒に設定されると、次回このプロパティにアクセスされたときに 14 分 0 秒の値が返されます。

使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim now As DateTime = DateTime.Now

        '	Create a TimeSpan that contains the same number of hours
        '	as the offset of the current time from midnight.
        Dim offset As TimeSpan = TimeSpan.FromHours(now.Hour)

        '	Create a TimeSpan that contains the number of hours remaining
        '	in the current day, including the current hour.
        Dim duration As TimeSpan = TimeSpan.FromHours((24 - now.Hour))

        '	Assign the offset to the UltraCalendarInfo's LogicalDayOffset
        '	property, so that the logical day begins on the current hour.
        Me.ultraCalendarInfo1.LogicalDayOffset = offset

        '	Assign the duration to the UltraCalendarInfo's LogicalDayDuration property,
        '	so that the logical day ends at midnight of the following day.
        Me.ultraCalendarInfo1.LogicalDayDuration = duration

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


		private void button1_Click(object sender, System.EventArgs e)
		{
			DateTime now = DateTime.Now;

			//	Create a TimeSpan that contains the same number of hours
			//	as the offset of the current time from midnight.
			TimeSpan offset = TimeSpan.FromHours( (double)now.Hour );

			//	Create a TimeSpan that contains the number of hours remaining
			//	in the current day, including the current hour.
			TimeSpan duration = TimeSpan.FromHours( (double)(24 - now.Hour) );

			//	Assign the offset to the UltraCalendarInfo's LogicalDayOffset
			//	property, so that the logical day begins on the current hour.
			this.ultraCalendarInfo1.LogicalDayOffset = offset;

			//	Assign the duration to the UltraCalendarInfo's LogicalDayDuration property,
			//	so that the logical day ends at midnight of the following day.
			this.ultraCalendarInfo1.LogicalDayDuration = duration;			
		}
参照