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

sender
e
delegate for handling event that is fired before a col scroll region is scrolled

Syntax

Visual Basic (Declaration) 
Public Delegate Sub BeforeColRegionScrollEventHandler( _
   ByVal sender As Object, _
   ByVal e As BeforeColRegionScrollEventArgs _
) 
C# 
public delegate void BeforeColRegionScrollEventHandler( 
   object sender,
   BeforeColRegionScrollEventArgs e
)

Parameters

sender
e

Example

Following code prevents columns from scrolling by canceling BeforeColRegionScroll 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_BeforeColRegionScroll(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeColRegionScrollEventArgs) Handles ultraGrid1.BeforeColRegionScroll

       ' There may be circumstances where you may want to conditionally prevent the user
       ' from scrolling. To accomplish that, you can hook into the BeforeColRegionScroll 
       ' event and cancel it when it gets fired.

       If Me.chkLockScrolling.Checked Then e.Cancel = True

       ' Write old and the new positions of the scroll bar.
       Debug.WriteLine("Old position of the scroll bar is " & e.OldState.Position)
       Debug.WriteLine("New position of the scroll bar is " & e.NewState.Position)

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

private void ultraGrid1_BeforeColRegionScroll(object sender, Infragistics.Win.UltraWinGrid.BeforeColRegionScrollEventArgs e)
{

	// There may be circumstances where you may want to conditionally prevent the user
	// from scrolling. To accomplish that, you can hook into the BeforeColRegionScroll 
	// event and cancel it when it gets fired.

	if ( this.chkLockScrolling.Checked )
		e.Cancel = true;

	// Write old and the new positions of the scroll bar.
	Debug.WriteLine( "Old position of the scroll bar is " + e.OldState.Position );
	Debug.WriteLine( "New position of the scroll bar is " + e.NewState.Position );

}

See Also