Infragistics2.Win.v8.1
IUIElementCursorFilter Interface
See Also  Members   Example
Infragistics.Win Namespace : IUIElementCursorFilter Interface

Interface supplied by the user of a control to allow custom cursors to be supplied

Syntax

Visual Basic (Declaration) 
Public Interface IUIElementCursorFilter 
C# 
public interface IUIElementCursorFilter 

Example

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



Visual BasicCopy Code
    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

C#Copy Code
       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’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;
           }

       }

See Also