バージョン

ToolTipDisplaying イベント

シンタックス
'宣言
 
Public Event ToolTipDisplaying As ToolTipDisplayingEventHandler
public event ToolTipDisplayingEventHandler ToolTipDisplaying
イベント データ

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

使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

	 '	Show tooltips for items whether the value is fully visible or not
    Me.ultraListView1.ItemSettings.TipStyle = ItemTipStyle.ShowAlways
    Me.ultraListView1.ViewSettingsDetails.SubItemTipStyle = SubItemTipStyle.ShowIfNeeded

    Private Sub ultraListView1_ToolTipDisplaying(ByVal sender As Object, ByVal e As ToolTipDisplayingEventArgs) Handles lvwFiles.ToolTipDisplaying

        '	Override the default tooltip behavior for folder items,
        '	so we can display a summary of the contents of the folder
        '	when the end user hovers over the item.
        If (e.IsToolTipForSubItem) Then Return

        Dim item As UltraListViewItem = e.Item

        Dim directoryInfo As directoryInfo = Nothing
        If item.Tag.GetType() Is GetType(directoryInfo) Then directoryInfo = CType(item.Tag, directoryInfo)

        If (Not directoryInfo Is Nothing) Then

            Dim sb As StringBuilder = New StringBuilder()
            Dim directories As directoryInfo() = directoryInfo.GetDirectories()
            Dim files As FileInfo() = directoryInfo.GetFiles()

            Dim limiter As Integer = 0
            Dim i As Integer

            If (directories.Length = 0 AndAlso files.Length = 0) Then
                sb.Append("Folder is empty")
            ElseIf (directories.Length > 0) Then

                sb.Append(directoryInfo.Name)
                sb.Append(Environment.NewLine)
                sb.Append("Folders: ")
                sb.Append(Environment.NewLine)

                limiter = Math.Min(5, directories.Length - 1)
                For i = 0 To limiter
                    sb.Append(directories(i).Name)
                    If (i < limiter) Then sb.Append(", ")
                Next

                If (limiter < (directories.Length - 1)) Then sb.Append("...")

            ElseIf (files.Length > 0) Then

                sb.Append(directoryInfo.Name)
                sb.Append(Environment.NewLine)
                sb.Append("Files: ")
                sb.Append(Environment.NewLine)

                limiter = Math.Min(5, files.Length - 1)
                For i = 0 To limiter
                    sb.Append(files(i).Name)
                    If (i < limiter) Then sb.Append(", ")
                Next

                If (limiter < (files.Length - 1)) Then
                    sb.Append("...")
                End If
            End If

            e.ToolTipText = sb.ToString()
        End If
    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using System.Diagnostics;

		//	Show tooltips for items whether the value is fully visible or not
		this.ultraListView1.ItemSettings.TipStyle = ItemTipStyle.ShowAlways;
		this.ultraListView1.ViewSettingsDetails.SubItemTipStyle = SubItemTipStyle.ShowIfNeeded;

		private void ultraListView1_ToolTipDisplaying(object sender, Infragistics.Win.UltraWinListView.ToolTipDisplayingEventArgs e)
		{
			//	Override the default tooltip behavior for folder items,
			//	so we can display a summary of the contents of the folder
			//	when the end user hovers over the item.
			if ( e.IsToolTipForSubItem )
				return;

			UltraListViewItem item = e.Item;
			DirectoryInfo directoryInfo = item.Tag as DirectoryInfo;
			if ( directoryInfo != null )
			{
				StringBuilder sb = new StringBuilder();
				DirectoryInfo[] directories = directoryInfo.GetDirectories();
				FileInfo[] files = directoryInfo.GetFiles();
				int limiter = 0;

				if ( directories.Length == 0 && files.Length == 0 )
					sb.Append( "Folder is empty" );
				else
				if ( directories.Length > 0 )
				{
					sb.Append( directoryInfo.Name );
					sb.Append( Environment.NewLine );
					sb.Append( "Folders: " );
					sb.Append( Environment.NewLine );

					limiter = Math.Min( 5, directories.Length - 1 );
					for ( int i = 0; i <= limiter; i ++ )
					{
						sb.Append( directories[i].Name );
						if ( i < limiter )
							sb.Append( ", " );
					}

					if ( limiter < (directories.Length - 1) )
						sb.Append( "..." );
				}
				else
				if ( files.Length > 0 )
				{
					sb.Append( directoryInfo.Name );
					sb.Append( Environment.NewLine );
					sb.Append( "Files: " );
					sb.Append( Environment.NewLine );

					limiter = Math.Min( 5, files.Length - 1 );
					for ( int i = 0; i <= limiter; i ++ )
					{
						sb.Append( files[i].Name );
						if ( i < limiter )
							sb.Append( ", " );
					}

					if ( limiter < (files.Length - 1) )
						sb.Append( "..." );
				}


				e.ToolTipText = sb.ToString();
			}
		}
参照