开发者

C# WinForm up down drag click

How do I capture a left mouse clic开发者_C百科k , 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)
            {
            }
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜