menu

WinForms

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

    Show / Hide Table of Contents

    Class IntelliMouseDragScroll

    Implements support for Intelli-Mouse panning. When the user presses the middle mouse button and drags the mouse, the window will scroll. ScrollControl has built-in support for this call. You only have to enable EnableIntelliMouse.

    Inheritance
    System.Object
    NonFinalizeDisposable
    IntelliMouseDragScroll
    Implements
    System.IDisposable
    Inherited Members
    NonFinalizeDisposable.Dispose()
    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
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public class IntelliMouseDragScroll : NonFinalizeDisposable, IDisposable
    Examples

    The following code enables support for IntelliMouseDragScroll:

        public bool EnableIntelliMouse
            {
                get
                {
                    return imm != null and imm.Enabled;
                }
                set
                {
                    if (value != EnableIntelliMouse)
                    {
                        if (imm == null)
                        {
                            imm = new IntelliMouseDragScroll(this, true);
                            imm.AllowScrolling = ScrollBars.Both;
                            imm.DragScroll += new IntelliMouseDragScrollEventHandler(IntelliMouseDragScrollEvent);
                        }
                        imm.Enabled = value;
                    }
                }
            }
    
            void IntelliMouseDragScrollEvent(object sender, IntelliMouseDragScrollEventArgs e)
            {
                int dy = e.Dy;
                int dx = e.Dx;
    
                this.disableAutoScroll = true;
                if (Math.Abs(dy) > Math.Abs(dx))
                {
                    VScrollBar.SendScrollMessage(dy > 0 ? ScrollEventType.SmallIncrement : ScrollEventType.SmallDecrement);
                }
                else
                {
                    HScrollBar.SendScrollMessage(dx > 0 ? ScrollEventType.SmallIncrement : ScrollEventType.SmallDecrement);
                }
                this.disableAutoScroll = false;
            }

    Constructors

    IntelliMouseDragScroll(Control)

    Initializes the IntelliMouseDragScroll object.

    Declaration
    public IntelliMouseDragScroll(Control control)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control

    The control to add this functionality to.

    IntelliMouseDragScroll(Control, Boolean)

    Initializes the IntelliMouseDragScroll object.

    Declaration
    public IntelliMouseDragScroll(Control control, bool hookMouseDownMessage)
    Parameters
    Type Name Description
    System.Windows.Forms.Control control

    The control to add this functionality to.

    System.Boolean hookMouseDownMessage

    True if IntelliMouseDragScroll should listen for MouseDown event; False if dragging should be started manually by calling StartDrag.

    Properties

    ActiveIntelliMouseDragScroll

    Returns the active IntelliMouseDragScroll object, if any.

    Declaration
    public static IntelliMouseDragScroll ActiveIntelliMouseDragScroll { get; }
    Property Value
    Type
    IntelliMouseDragScroll

    AllowScrolling

    Gets / sets the scrolling direction.

    Declaration
    public ScrollBars AllowScrolling { get; set; }
    Property Value
    Type
    System.Windows.Forms.ScrollBars

    Cursor

    Returns the cursor to be displayed.

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

    Enabled

    Indicates whether to toggle the Intelli-Mouse feature on or off.

    Declaration
    public bool Enabled { get; set; }
    Property Value
    Type
    System.Boolean

    IsDragging

    Indicates whether the user is dragging.

    Declaration
    public bool IsDragging { get; }
    Property Value
    Type
    System.Boolean

    Methods

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    NonFinalizeDisposable.Dispose(Boolean)

    StartDrag(Point)

    Starts the IntelliMouse dragging at the given screen coordinates.

    Declaration
    public void StartDrag(Point startPoint)
    Parameters
    Type Name Description
    System.Drawing.Point startPoint

    Screen coordinates, e.g. Control.MousePosition.

    StopDrag()

    Stops the Intelli-Mouse dragging.

    Declaration
    public void StopDrag()

    Events

    DragScroll

    Occurs when the user has dragged the mouse outside the scrolling bitmap.

    Declaration
    public event IntelliMouseDragScrollEventHandler DragScroll
    Event Type
    Type
    IntelliMouseDragScrollEventHandler

    Implements

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