We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Mouse Move Event on Every Mouse Click Event

Thread ID:

Created:

Updated:

Platform:

Replies:

1384 Oct 23,2002 01:02 AM Oct 23,2002 03:47 AM Windows Forms 1
loading
Tags: FAQ
Agha Ali Raza
Asked On October 23, 2002 01:02 AM

Hi, Can any body tell me why am I getting a mouse move event with every mouse click event. I am having a simple form without any control on it. I have two handlers one for mouse move and one for mouse click. I am printing a Console.Writeline("Mouse Clicked") in mouse click handler and Console.Writeline("Mouse Moved") in mouse move handler. But whenever I click on the form follwoing lines are printed Mouse Clicked Mouse Moved Why is that? Please help me.

Administrator [Syncfusion]
Replied On October 23, 2002 03:47 AM

I don't know why Microsoft is firing a MouseMove after a click, whether its is by design or just a bug. But you can ignore it in your code by setting a flag in the click handler and testing it in the mousemove handler.
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
	If bIgnoreMouseMove Then
		bIgnoreMouseMove = False
		Return
	End If
	Console.WriteLine("Form1_MouseMove")
End Sub

Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click

	Console.WriteLine("Form1_Click")
	bIgnoreMouseMove = True
End Sub

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;