Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DoubleClick and MouseDown

Posted on 2006-07-09
5
Medium Priority
?
800 Views
Last Modified: 2009-02-12
Im using MouseDown, MouseMove and MouseUp to reposition controls on a panel. I also need to use DoubleClick but the problem is the MouseDown-Move-Up sequence is performed when I double click on the control. If someone has some example code for this it would be really nice to see.

Thanks
0
Comment
Question by:craigdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
vadim63 earned 1000 total points
ID: 17070186
I had the same problem. I've found a good example for DragDrop, but you can use it for any purposes:

" The idea is to wait with starting the DoDragDrop event until the doubleclick event should have fired, if that hasn't fired, then do it. The code, in case other people run into the same problem:

Class variable
Private IsWaitingForDoubleClick As Boolean

Set during load (Add a timer first)
Timer1.Interval = SystemInformation.DoubleClickTime

Private Sub DocList_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DocList.MouseMove
    If Not e.Button = MouseButtons.Left Then Return
    StartWaitForDoubleClick()
End Sub
Private Sub DocList_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DocList.MouseUp
    EndWaitForDoubleclick()
End Sub

Private Sub StartWaitForDoubleClick()
    'This remains true until the timer fires, or the mouse button is released
    IsWaitingForDoubleClick = True
    Timer1.Enabled = True
End Sub
Private Sub EndWaitForDoubleclick()
    IsWaitingForDoubleClick = False
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    If IsWaitingForDoubleClick Then
        IsWaitingForDoubleClick = False
        StartDragDrop()
    End If
    sender.Enabled = False
End Sub

Private Sub StartDragDrop()
    DocList.DoDragDrop(DocList.SelectedItems(0),DragDropEffects.Copy)
End Sub

This way the mouseClick and mouseDoubleClick events will fire as normally, and you can put any code you like into there."
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17070277
Check e.Clicks for a value > 1.

Bob
0
 
LVL 1

Author Comment

by:craigdev
ID: 17070297
In which function, MouseMove, Up or Down? I tried all three so Im not sure what you mean
0
 
LVL 1

Author Comment

by:craigdev
ID: 17070531
>> Check e.Clicks for a value > 1
Please elaborate, thanks
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17072197
I imagine the MouseMove event, since it is normally where the work is done, but you have to tell me.  Not enough information there to really say.

Bob
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question