Infragistics(R) NetAdvantage(R) Windows Forms
VisibleHeader Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : VisibleHeader Class

Summary description for VisibleHeader.

Syntax

Visual Basic (Declaration) 
Public NotInheritable Class VisibleHeader 
   Inherits Infragistics.Shared.SubObjectBase
C# 
public sealed class VisibleHeader : Infragistics.Shared.SubObjectBase 

Example

Following code shows some of the information available in AfterColRegionScroll event.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_AfterColRegionScroll(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ColScrollRegionEventArgs) Handles ultraGrid1.AfterColRegionScroll

       ' AfterColRegionScroll gets fired after a col scroll region has been scrolled.
       ' VisibleHeaders property off the col scroll region can be used to access the
       ' headers that are visible. Following code prints out the visible headers as
       ' the col scroll region is scrolled.

       ' Loop throw all the visible headers and print them out.
       Debug.WriteLine("New visible headers in the col scroll region are: ")
       Dim i As Integer
       For i = 0 To e.ColScrollRegion.VisibleHeaders.Count - 1
           Dim vh As VisibleHeader = e.ColScrollRegion.VisibleHeaders(i)

           ' Get the header associated with the vh VisibleHeader.
           Dim header As HeaderBase = e.ColScrollRegion.VisibleHeaders(i).Header

           If TypeOf header Is Infragistics.Win.UltraWinGrid.ColumnHeader Then
               ' Print out the associated column's key and it's origin (relative to the col scroll region) and the width.
               Debug.WriteLine("    " & header.Band.Key & "." & header.Column.Key & "'s Origin = " & vh.Origin & ", Extent = " & vh.Extent)
           ElseIf TypeOf header Is GroupHeader Then
               ' the header could be a group as well.
               Debug.WriteLine("    " & header.Caption & " group header's Origin = " & vh.Origin & ", Extent = " & vh.Extent)
           ElseIf TypeOf header Is BandHeader Then
               ' the header could be a band header as well.
               Debug.WriteLine("    " & header.Caption & " band header's Origin = " & vh.Origin & ", Extent = " & vh.Extent)
           End If
       Next

   End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_AfterColRegionScroll(object sender, Infragistics.Win.UltraWinGrid.ColScrollRegionEventArgs e)
{

	// AfterColRegionScroll gets fired after a col scroll region has been scrolled.
	// VisibleHeaders property off the col scroll region can be used to access the
	// headers that are visible. Following code prints out the visible headers as
	// the col scroll region is scrolled.

	// Loop throw all the visible headers and print them out.
	Debug.WriteLine( "New visible headers in the col scroll region are: " );
	for ( int i = 0; i < e.ColScrollRegion.VisibleHeaders.Count; i++ )
	{
		VisibleHeader vh = e.ColScrollRegion.VisibleHeaders[i];

		// Get the header associated with the vh VisibleHeader.
		HeaderBase header = e.ColScrollRegion.VisibleHeaders[i].Header;
	
		if ( header is Infragistics.Win.UltraWinGrid.ColumnHeader )
		{
			// Print out the associated column's key and it's origin (relative to the col scroll region) and the width.
			Debug.WriteLine( "    " + header.Band.Key + "." + header.Column.Key + "'s Origin = " + vh.Origin + ", Extent = " + vh.Extent );
		}
		else if ( header is GroupHeader )
		{
			// the header could be a group as well.
			Debug.WriteLine( "    " + header.Caption + " group header's Origin = " + vh.Origin + ", Extent = " + vh.Extent );
		}
		else if ( header is BandHeader )
		{
			// the header could be a band header as well.
			Debug.WriteLine( "    " + header.Caption + " band header's Origin = " + vh.Origin + ", Extent = " + vh.Extent );
		}
	}

}

See Also