Home All Groups Group Topic Archive Search About

MouseMove event not firing

Author
24 Mar 2006 7:29 AM
TyBreaker
I'm writing a screen saver using Visual Studio 2005 (Basic) and I have a
Form which contains a PictureBox.  I have two events, Click and
MouseMove that I'd like to cause the program to end (see below) as one
would expect from a screen saver.  Well my Click event fires but for
some reason my MouseMove event does not.  Both the Form and the
PictureBox are enabled.

In my Form_Load routine, I tried placing "Me.Capture = true" which
according to the help says it grabs all mouse events - even if the mouse
is outside the control (my form starts maximised so this shouldn't be a
problem).  MouseMove then fires correctly but the Click event then takes
two clicks before it fires. Frustrating!  I just want my application to
end when either event happens.

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox1.Click
   End
End Sub

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles Me.MouseMove
   End
End Sub

Grateful for any assistance :)
--
  ______     ___               __
/_  __/_ __/ _ )_______ ___ _/ /_____ ____
  / / / // / _  / __/ -_) _ `/  '_/ -_) __/
/_/  \_, /____/_/  \__/\_,_/_/\_\\__/_/
     /___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.

--
  ______     ___               __
/_  __/_ __/ _ )_______ ___ _/ /_____ ____
  / / / // / _  / __/ -_) _ `/  '_/ -_) __/
/_/  \_, /____/_/  \__/\_,_/_/\_\\__/_/
     /___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.

Author
24 Mar 2006 7:56 AM
Peter Proost
Hi tybreaker,

shouldn't Me.MouseMove be  PictureBox1.MouseMove

> Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
> MouseEventArgs) Handles Me.MouseMove
>    End
> End Sub

should be
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles PictureBox1.MouseMove
   End
End Sub

hth Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"TyBreaker" <tybreakerNO@SPAMhotmail.com> schreef in bericht
news:uISNVTxTGHA.5972@TK2MSFTNGP10.phx.gbl...
> I'm writing a screen saver using Visual Studio 2005 (Basic) and I have a
> Form which contains a PictureBox.  I have two events, Click and
> MouseMove that I'd like to cause the program to end (see below) as one
> would expect from a screen saver.  Well my Click event fires but for
> some reason my MouseMove event does not.  Both the Form and the
> PictureBox are enabled.
>
> In my Form_Load routine, I tried placing "Me.Capture = true" which
> according to the help says it grabs all mouse events - even if the mouse
> is outside the control (my form starts maximised so this shouldn't be a
> problem).  MouseMove then fires correctly but the Click event then takes
> two clicks before it fires. Frustrating!  I just want my application to
> end when either event happens.
>
> Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles PictureBox1.Click
>    End
> End Sub
>
> Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
> MouseEventArgs) Handles Me.MouseMove
>    End
> End Sub
>
> Grateful for any assistance :)
> --
>   ______     ___               __
> /_  __/_ __/ _ )_______ ___ _/ /_____ ____
>   / / / // / _  / __/ -_) _ `/  '_/ -_) __/
> /_/  \_, /____/_/  \__/\_,_/_/\_\\__/_/
>      /___/
>
> There are 10 types of people in this world; those who understand the
> binary numbering system and those who don't.
>
> There's no place like 127.0.0.1.
>
> ASCII a silly question, get a silly ANSI.
>
> --
>   ______     ___               __
> /_  __/_ __/ _ )_______ ___ _/ /_____ ____
>   / / / // / _  / __/ -_) _ `/  '_/ -_) __/
> /_/  \_, /____/_/  \__/\_,_/_/\_\\__/_/
>      /___/
>
> There are 10 types of people in this world; those who understand the
> binary numbering system and those who don't.
>
> There's no place like 127.0.0.1.
>
> ASCII a silly question, get a silly ANSI.
Author
24 Mar 2006 9:58 AM
TyBreaker
Peter Proost wrote:
Show quoteHide quote
> Hi tybreaker,
>
> shouldn't Me.MouseMove be  PictureBox1.MouseMove
>
>> Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
>> MouseEventArgs) Handles Me.MouseMove
>>    End
>> End Sub
>
> should be
> Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
> MouseEventArgs) Handles PictureBox1.MouseMove
>    End
> End Sub
>
> hth Greetz Peter

Wow, thank you.  My ignorance of the language is obvious!  I'm not sure
how I mucked that up - the routine declarations get inserted
automatically but I must have done something to stuff it up at some point.
--
  ______     ___               __
/_  __/_ __/ _ )_______ ___ _/ /_____ ____
  / / / // / _  / __/ -_) _ `/  '_/ -_) __/
/_/  \_, /____/_/  \__/\_,_/_/\_\\__/_/
     /___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
Author
24 Mar 2006 12:23 PM
Peter Proost
Glad I could help you, but that's what we're here for, to help each other
:-)

Greetz, Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"TyBreaker" <tybreakerNO@SPAMhotmail.com> schreef in bericht
news:Oh1dgmyTGHA.424@TK2MSFTNGP12.phx.gbl...
> Peter Proost wrote:
> > Hi tybreaker,
> >
> > shouldn't Me.MouseMove be  PictureBox1.MouseMove
> >
> >> Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
> >> MouseEventArgs) Handles Me.MouseMove
> >>    End
> >> End Sub
> >
> > should be
> > Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As
> > MouseEventArgs) Handles PictureBox1.MouseMove
> >    End
> > End Sub
> >
> > hth Greetz Peter
>
> Wow, thank you.  My ignorance of the language is obvious!  I'm not sure
> how I mucked that up - the routine declarations get inserted
> automatically but I must have done something to stuff it up at some point.
> --
>   ______     ___               __
> /_  __/_ __/ _ )_______ ___ _/ /_____ ____
>   / / / // / _  / __/ -_) _ `/  '_/ -_) __/
> /_/  \_, /____/_/  \__/\_,_/_/\_\\__/_/
>      /___/
>
> There are 10 types of people in this world; those who understand the
> binary numbering system and those who don't.
>
> There's no place like 127.0.0.1.
>
> ASCII a silly question, get a silly ANSI.