他の時間の間隔をネストするさまざまの時間の間隔を表示するのに UltraTimelineView コントロールを設定できます。ただし、ColumnWidth プロパティは、PrimaryInterval によって作成されたヘッダーのみに適用されます。ColumnWidth プロパティはこの列の幅 (ピクセル) を決定します。
PrimaryInterval によって作成されたヘッダーは、常にこのプロパティによって幅が指定されます。AdditionalIntervals コレクションのメンバーによって作成されたヘッダーの幅は、この幅に依存します。たとえば、標準の間隔は15 分間隔のヘッダーを作成します。またdditionalIntervals コレクションには 1 時間間隔が含まれます。この 1 時間間隔で作成された各ヘッダーは、標準の間隔によって作成された幅の 4 倍になります。
Imports System.Collections.Generic Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Public Sub InitColumnProps(ByVal control As UltraTimelineView) ' Set ColumnAutoSizing to 'AllVisibleIntervals' so that when the user auto-sizes ' the columns, the width required to show the additional interval's captions is considered control.ColumnAutoSizing = TimelineViewColumnAutoSizing.AllVisibleIntervals ' Use the ColumnHeaderAppearance to customize the look for all headers control.ColumnHeaderAppearance.BackColor = Color.White control.ColumnHeaderAppearance.BackColor2 = Color.LightBlue control.ColumnHeaderAppearance.BorderColor = Color.DarkBlue control.ColumnHeaderAppearance.ForeColor = Color.DarkBlue ' Don't show images on the headers control.ColumnHeaderImageVisible = False ' Only display the minutes for the primary interval, if there is ' an additional interval being displayed for the hours. Dim hasHourInterval As Boolean = False For Each dti As DateTimeInterval In control.VisibleIntervals Dim timeInterval As TimeInterval = IIf(dti.GetType() Is GetType(TimeInterval), dti, Nothing) If Not timeInterval Is Nothing AndAlso timeInterval.IntervalUnits = TimeIntervalUnits.Hours Then hasHourInterval = True End If next control.PrimaryInterval.HeaderTextFormat = IIf(hasHourInterval, "mm", Nothing) ' Orient the text for the primary interval on a diagonal control.PrimaryInterval.HeaderTextOrientation = New TextOrientationInfo(45, TextFlowDirection.Horizontal) ' Set the ideal width for the column headers control.PerformColumnAutoResize(TimelineViewColumnAutoSizing.AllVisibleIntervals) End Sub
using System.Collections.Generic; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; public void InitColumnProps( UltraTimelineView control ) { // Set ColumnAutoSizing to 'AllVisibleIntervals' so that when the user auto-sizes // the columns, the width required to show the additional interval's captions is considered control.ColumnAutoSizing = TimelineViewColumnAutoSizing.AllVisibleIntervals; // Use the ColumnHeaderAppearance to customize the look for all headers control.ColumnHeaderAppearance.BackColor = Color.White; control.ColumnHeaderAppearance.BackColor2 = Color.LightBlue; control.ColumnHeaderAppearance.BorderColor = Color.DarkBlue; control.ColumnHeaderAppearance.ForeColor = Color.DarkBlue; // Don't show images on the headers control.ColumnHeaderImageVisible = false; // Only display the minutes for the primary interval, if there is // an additional interval being displayed for the hours. bool hasHourInterval = false; foreach( DateTimeInterval dti in control.VisibleIntervals ) { TimeInterval timeInterval = dti as TimeInterval; if ( timeInterval != null && timeInterval.IntervalUnits == TimeIntervalUnits.Hours ) hasHourInterval = true; } control.PrimaryInterval.HeaderTextFormat = hasHourInterval ? "mm" : null; // Orient the text for the primary interval on a diagonal control.PrimaryInterval.HeaderTextOrientation = new TextOrientationInfo(45, TextFlowDirection.Horizontal); // Set the ideal width for the column headers control.PerformColumnAutoResize( TimelineViewColumnAutoSizing.AllVisibleIntervals ); }