C# WinForm up down drag click – Education Career Blog

How do I capture a left mouse click , up/down/drag? What would the right mouse click be?

,

Overriding OnMouseClick, OnMouseDown, or OnMouseUp would be the way to go. The MouseEventArgs class can contains members which will help you figure out which button(s) were pressed.

Dragging is a different animal altogether. You need to override the OnDragEnter and OnDragDrop methods, and you will also need to initiate the drag-drop operation by calling DoDragDrop at the appropriate time.

,

try this:

private void FormA_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
            }
            else if (e.Button == MouseButtons.Right)
            {
            }
        }

Leave a Comment