Version

CursorFilter Property (UltraControlBase)

Gets/sets the cursor filter property
Syntax
'Declaration
 
Public Property CursorFilter As IUIElementCursorFilter
public IUIElementCursorFilter CursorFilter {get; set;}
Example

The following sample code illustrates how to supply a custom resize cursor for column headers in an UltraGrid. control



Imports Infragistics.Win
    Imports Infragistics.Win.UltraWinGrid

' Implement the IUIElementCursorFilter interface on a class
' (in this case the form)
Public Class Form1
    Inherits System.Windows.Forms.Form
    Implements Infragistics.Win.IUIElementCursorFilter

    Private customCursor As Cursor

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' Load and cache the resize cursor from an embedded resource 
        Me.customCursor = New Cursor(Me.GetType(), "MyResizeCursor.cur")

        ' Set the grid’s CursorFilter property to the object that
        ' implements the IUIElementCursorFilter interface.
        Me.UltraGrid1.CursorFilter = Me

    End Sub


    Public Sub BeforeSetCursor(ByVal element As Infragistics.Win.UIElement, ByVal adjustableCursor As Boolean, ByRef cursor As System.Windows.Forms.Cursor) Implements Infragistics.Win.IUIElementCursorFilter.BeforeSetCursor
        
        ' If the mouse is over the adjustable area of a 
        ' HeaderUIElement then return our custom resize cursor
        If adjustableCursor = True Then
            If TypeOf (element) Is HeaderUIElement Then
                cursor = Me.customCursor
            End If
        End If

    End Sub
using System.Diagnostics;
	using Infragistics.Win;
	using Infragistics.Win.UltraWinGrid;

// Implement the IUIElementCursorFilter interface on a class
// (in this case the form)
public class Form1 : 
		System.Windows.Forms.Form, 
		Infragistics.Win.IUIElementCursorFilter
{

	private Cursor myCustomCursor = null;

	private void Form1_Load(object sender, System.EventArgs e)
	{

		// Set the grid’s CursorFilter property to the object that
		// implements the IUIElementCursorFilter interface.
		this.ultraGrid1.CursorFilter = this;

		// Load and cache the resize cursor from an embedded resource 
		this.myCustomCursor = new Cursor(this.GetType(), "MyResizeCursor.cur");

	}

	public void BeforeSetCursor(Infragistics.Win.UIElement element, bool adjustableCursor, ref System.Windows.Forms.Cursor cursor)
	{

		// If the mouse is over the adjustable area of a 
		// HeaderUIElement then return our custom resize cursor
		if ( adjustableCursor && 
			 element is HeaderUIElement )
		{
			cursor = this.myCustomCursor;
		}

	}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also