menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridTableClickCellsMouseController - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridTableClickCellsMouseController

    This MouseController handles mouse events for cell elements. In its HitTest method, the cell renderer for the cell under the mouse cursor is determined and based on the cell renderer's HitTest result, mouse events will be forwarded to that cell.

    Inheritance
    System.Object
    NonFinalizeDisposable
    GridSubComponent
    GridMouseController
    GridTableClickCellsMouseController
    Implements
    System.IDisposable
    IMouseController
    IGridFocusHelper
    Inherited Members
    GridMouseController.GetAllowFixFocus()
    GridSubComponent.Grid
    NonFinalizeDisposable.Dispose()
    NonFinalizeDisposable.Dispose(Boolean)
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Grid.Grouping
    Assembly: Syncfusion.Grid.Grouping.Windows.dll
    Syntax
    public class GridTableClickCellsMouseController : GridMouseController, IDisposable, IMouseController, IGridFocusHelper
    Remarks

    This mouse controller manages the calls to each Cell Renderer's OnHitTest, OnMouseDown, OnMouseHover, OnMouseUp, OnMouseHoverEnter, OnMouseHoverLeave, and OnCancelMode methods. If a cell renderer's OnHitTest method returns a non-zero value, the cell renderer will receive mouse events associated with that cell.

    If a cell has cell button elements and the mouse is over a cell button element, the cell button element will receive all mouse events associated with that cell button element.

    If the user clicks on a cell button element, the cell button element will raise a Click event in its OnMouseUp event handler.

    This MouseController is not used by the GridControl by default. Instead all this functionality is provided by GridSelectCellsMouseController. However, the grouping grid control uses this controller to forward events to cell renderers.

    Examples

    This example shows some code samples from GroupDropAreaDragHeaderMouseController where the mouse events are forwarded to the GridTableClickCellsMouseController:

        public class GroupDropAreaDragHeaderMouseController : GroupDragHeaderMouseControllerBase
        {
            public GroupDropAreaDragHeaderMouseController(GridGroupDropArea grid)
            {
                this.groupDropArea = grid;
                isGroupAreaOrigin = true;
                clickCellsController = new GridTableClickCellsMouseController(grid);
            }
    

    internal GridTableClickCellsMouseController clickCellsController; int clickCellsControllerHitTest = 0;

    public GridTableClickCellsMouseController ClickCellsController { get { return clickCellsController; } }

    public void ResetClickCellsController() { if (this.entered) clickCellsController.MouseHoverLeave(EventArgs.Empty); else if (clickCellsControllerHitTest != 0) clickCellsController.CancelMode(); entered = false; clickCellsControllerHitTest = 0; }

    // unrelated code left out here ...

    #region IMouseController implementation

    public virtual string Name { get { return "DragGroupHeader"; } }

    public virtual Cursor Cursor { get { if (cursor != null) return cursor; return clickCellsController.Cursor; } }

    bool entered = false;

    public virtual void MouseHoverEnter() { if (clickCellsControllerHitTest != 0) { entered = true; clickCellsController.MouseHoverEnter(); } }

    public virtual void MouseHover(MouseEventArgs e) { if (clickCellsControllerHitTest != 0) clickCellsController.MouseHover(e); }

    public virtual void MouseHoverLeave(EventArgs e) { if (entered) { clickCellsController.MouseHoverLeave(e); entered = false; } }

    public virtual void MouseDown(MouseEventArgs e) { if (clickCellsControllerHitTest != 0) clickCellsController.MouseDown(e); }

    public virtual void MouseMove(MouseEventArgs e) { if (clickCellsControllerHitTest != 0) clickCellsController.MouseMove(e); }

    public virtual void MouseUp(MouseEventArgs e) { if (clickCellsControllerHitTest != 0) clickCellsController.MouseUp(e); }

    public virtual void CancelMode() { if (clickCellsControllerHitTest != 0) clickCellsController.CancelMode(); }

    public virtual int HitTest(MouseEventArgs e, IMouseController controller) { clickCellsControllerHitTest = clickCellsController.HitTest(e, controller); return clickCellsControllerHitTest; }

    #endregion }

    Constructors

    GridTableClickCellsMouseController(GridControlBase)

    Initializes a new instance of the GridTableClickCellsMouseController class.

    Declaration
    public GridTableClickCellsMouseController(GridControlBase grid)
    Parameters
    Type Name Description
    GridControlBase grid

    The parent grid control.

    Properties

    Cursor

    Gets the cursor.

    Declaration
    public override Cursor Cursor { get; }
    Property Value
    Type
    System.Windows.Forms.Cursor
    Overrides
    GridMouseController.Cursor

    Name

    Gets the name of the mouse controller.

    Declaration
    public override string Name { get; }
    Property Value
    Type
    System.String
    Overrides
    GridMouseController.Name

    Methods

    CancelMode()

    CancelMode is called for the active controller after a MouseDown message when the mouse operation is cancelled.

    Declaration
    public override void CancelMode()
    Overrides
    GridMouseController.CancelMode()

    HitTest(MouseEventArgs, IMouseController)

    HitTest is called to determine whether your controller wants to handle the mouse events based current context.

    Declaration
    public override int HitTest(MouseEventArgs e, IMouseController controller)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains the event data.

    IMouseController controller

    A IMouseController that has indicated to handle the mouse event.

    Returns
    Type Description
    System.Int32

    A non-zero value if the button can and wants to handle the mouse event; 0 if the mouse event is unrelated for this button.

    Overrides
    GridMouseController.HitTest(MouseEventArgs, IMouseController)

    MouseDown(MouseEventArgs)

    Overrides and triggered when the mouse down event is done.

    Declaration
    public override void MouseDown(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains the event data.

    Overrides
    GridMouseController.MouseDown(MouseEventArgs)

    MouseHover(MouseEventArgs)

    Overrides and triggered when the mouse hover event is done.

    Declaration
    public override void MouseHover(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains the event data.

    Overrides
    GridMouseController.MouseHover(MouseEventArgs)

    MouseHoverEnter()

    Overrides and triggered when the mouse hover enter event is done.

    Declaration
    public override void MouseHoverEnter()
    Overrides
    GridMouseController.MouseHoverEnter()

    MouseHoverLeave(EventArgs)

    Overrides and triggered when the moue hover leave event is done and when context changes (e.g. user pressed the mouse button).

    Declaration
    public override void MouseHoverLeave(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    An System.EventArgs contain the event data.

    Overrides
    GridMouseController.MouseHoverLeave(EventArgs)

    MouseMove(MouseEventArgs)

    Overrides and triggered when the mouse move event is done.

    Declaration
    public override void MouseMove(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains the event data.

    Overrides
    GridMouseController.MouseMove(MouseEventArgs)

    MouseUp(MouseEventArgs)

    Overrides and triggered when the mouse up event is done.

    Declaration
    public override void MouseUp(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    A System.Windows.Forms.MouseEventArgs contains the event data.

    Overrides
    GridMouseController.MouseUp(MouseEventArgs)

    Implements

    System.IDisposable
    IMouseController
    IGridFocusHelper
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved