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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Mouse Move Event on Every Mouse Click Event

Thread ID:





1384 Oct 23,2002 05:02 AM UTC Oct 23,2002 07:47 AM UTC WinForms 1
Tags: FAQ
Agha Ali Raza
Asked On October 23, 2002 05:02 AM UTC

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 07:47 AM UTC

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
	End If
End Sub

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

	bIgnoreMouseMove = True
End Sub


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon