バージョン

ColumnHeaderInitializing イベント

ColumnHeaderUIElementによって子要素が初期化される直前に発生します。リスナーは表示されるテキストまたは画像を変更できます。
シンタックス
'宣言
 
Public Event ColumnHeaderInitializing As ColumnHeaderInitializingHandler
public event ColumnHeaderInitializingHandler ColumnHeaderInitializing
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、ColumnHeaderInitializingEventArgs 型の引数を受け取りました。次の ColumnHeaderInitializingEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
AppearanceData 特定なヘッダーの解決された外観をオーバーライドするのに使用できる AppearanceData 構造を取得または設定します。
DateTimeInterval 列ヘッダーが表示される DateTimeInterval インスタンスを返します。
DateTimeRange ヘッダーの日付/時刻の範囲を説明する DateTimeRange インスタンスを返します。
HeaderElement 初期化されている ColumnHeaderUIElement インスタンスを返します。
Text ヘッダーに表示されるテキストを取得または設定します。
使用例
Imports System.Collections.Generic
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

    Public Sub ShowClocks(ByVal control As UltraTimelineView)
        '  Don't show any additional intervals
        control.AdditionalIntervals.Clear()

        '  Create a new TimeInterval with 15-minute intervals
        '  and assign it to the PrimaryInterval property.
        Dim primaryInterval As New TimeInterval(15, TimeIntervalUnits.Minutes)
        control.PrimaryInterval = primaryInterval

        '  Set the image alignment to middle/center
        control.ColumnHeaderAppearance.ImageHAlign = HAlign.Center
        control.ColumnHeaderAppearance.ImageVAlign = VAlign.Middle

        '  Set ColumnHeaderImageSize to a size that is large
        '  enough to display an analog clock image set the
        '  ColumnWidth property to a slightly larger size.
        control.ColumnHeaderImageSize = ClockSize
        control.ColumnWidth = ClockSize.Width + Padding

        '  Handle the ColumnHeaderInitializing event so we can
        '  show an image on the header instead of the text, and
        '  the ColumnHeaderToolTipDisplaying event so we can force
        '  a tooltip to be displayed.
        AddHandler control.ColumnHeaderInitializing, AddressOf Me.OnColumnHeaderInitializing
        AddHandler control.ColumnHeaderToolTipDisplaying, AddressOf Me.OnColumnHeaderToolTipDisplaying
    End Sub


    Private Sub OnColumnHeaderToolTipDisplaying(ByVal sender As Object, ByVal e As ColumnHeaderToolTipDisplayingEventArgs)

        '  If this is a primary interval header, show the start time
        '  in a tooltip, since there is no text on the header.
        If Not e.HeaderElement Is Nothing AndAlso e.HeaderElement.DateTimeInterval.IsPrimaryInterval Then
            Dim toolTipInfo As ToolTipInfo = e.ToolTipInfo
            toolTipInfo.ToolTipText = e.HeaderElement.DateTimeRange.StartDateTime.ToString(TimeInterval.ShortTimePattern)
            e.ToolTipInfo = toolTipInfo
        End If
    End Sub

    Private Sub OnColumnHeaderInitializing(ByVal sender As Object, ByVal e As ColumnHeaderInitializingEventArgs)

        If (e.DateTimeInterval.IsPrimaryInterval) Then
            '  Create an image of an analog clock, depicting the
            '  start time for this header, and assign it to the
            '  Image property of the e.AppearanceData
            Dim time As TimeSpan = e.DateTimeRange.StartDateTime.TimeOfDay
            Dim bmp As Bitmap = ClockImage.GetImage(time, ClockSize, Color.Black, Color.White)
            Dim appData As AppearanceData = New AppearanceData()
            appData.Image = bmp
            e.AppearanceData = appData

            '  Assign a space character to the text, so that
            '  nothing appears, but a tooltip can still be displayed
            e.Text = " "
        End If
    End Sub
using System.Collections.Generic;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using System.Diagnostics;

    public void ShowClocks( UltraTimelineView control )
    {
        //  Don't show any additional intervals
        control.AdditionalIntervals.Clear();

        //  Create a new TimeInterval with 15-minute intervals
        //  and assign it to the PrimaryInterval property.
        TimeInterval primaryInterval = new TimeInterval(15, TimeIntervalUnits.Minutes);
        control.PrimaryInterval = primaryInterval;

        //  Set the image alignment to middle/center
        control.ColumnHeaderAppearance.ImageHAlign = HAlign.Center;
        control.ColumnHeaderAppearance.ImageVAlign = VAlign.Middle;

        //  Set ColumnHeaderImageSize to a size that is large
        //  enough to display an analog clock image; set the
        //  ColumnWidth property to a slightly larger size,
        //  and set MinimumColumnResizeWidth as well so the user
        //  can't resize the headers any smaller than that size.
        control.ColumnHeaderImageSize = ClockSize;
        control.ColumnWidth = ClockSize.Width + Padding;
        control.MinimumColumnResizeWidth = control.ColumnWidth;

        //  Handle the ColumnHeaderInitializing event so we can
        //  show an image on the header instead of the text, and
        //  the ColumnHeaderToolTipDisplaying event so we can force
        //  a tooltip to be displayed.
        control.ColumnHeaderInitializing += new ColumnHeaderInitializingHandler(this.OnColumnHeaderInitializing);
        control.ColumnHeaderToolTipDisplaying += new ColumnHeaderToolTipDisplayingHandler(OnColumnHeaderToolTipDisplaying);
    }

    private void OnColumnHeaderToolTipDisplaying(object sender, ColumnHeaderToolTipDisplayingEventArgs e)
    {
        //  If this is a primary interval header, show the start time
        //  in a tooltip, since there is no text on the header.
        if ( e.HeaderElement != null && e.HeaderElement.DateTimeInterval.IsPrimaryInterval )
        {
            ToolTipInfo toolTipInfo = e.ToolTipInfo;
            toolTipInfo.ToolTipText = e.HeaderElement.DateTimeRange.StartDateTime.ToString(TimeInterval.ShortTimePattern);
            e.ToolTipInfo = toolTipInfo;
        }
    }

    private void OnColumnHeaderInitializing(object sender, ColumnHeaderInitializingEventArgs e)
    {
        if ( e.DateTimeInterval.IsPrimaryInterval )
        {
            //  Create an image of an analog clock, depicting the
            //  start time for this header, and assign it to the
            //  Image property of the e.AppearanceData
            TimeSpan time = e.DateTimeRange.StartDateTime.TimeOfDay;
            Bitmap bmp = ClockImage.GetImage( time, ClockSize, Color.Black, Color.White );
            AppearanceData appData = new AppearanceData();
            appData.Image = bmp;
            e.AppearanceData = appData;

            //  Assign a space character to the text, so that
            //  nothing appears, but a tooltip can still be displayed
            e.Text = " ";
        }
    }
参照