Mouse/Screen Image Status

  • Thread starter Thread starter gene kelley
  • Start date Start date
G

gene kelley

Is it possible to determine if the image under a mouse changes in VB.net
code? For example if I position the mouse using the command;
Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)

Is there code that would help me determine if the image under it has
changed?
Changed how?
A new image has replaced a previous image?
It's the same image, but has been modified?

Gene
 
Is it possible to determine if the image under a mouse changes in VB.net
code? For example if I position the mouse using the command;
Windows.Forms.Cursor.Position = New System.Drawing.Point(680, 595)

Is there code that would help me determine if the image under it has
changed?
 
Well, when I position the mouse in a certian area, eventually a new image
will replace what was there. I wanted to tell my program exactly when that
happened.
 
Well, when I position the mouse in a certian area, eventually a new image
will replace what was there. I wanted to tell my program exactly when that
happened.

There's not enough app description given to provide a definitive
answer.

You might take a look at the PictureBox Invalidated event which fires
whenever an image is loaded. You might be able to adapt something
like this:


Private CursorInBox as Boolean


Private Sub PictureBox1_MouseEnter(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
CursorInBox = True
End Sub

Private Sub PictureBox1_MouseLeave(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
CursorInBox = False
End Sub

Private Sub PictureBox1_Invalidated(ByVal sender As Object, _
ByVal e As System.Windows.Forms.InvalidateEventArgs) Handles _
PictureBox1.Invalidated
If CursorInBox Then
MsgBox("Picture changed")
End If

End Sub

Gene
 
Daniel said:
The image is outside my form, so I am unsure what to do next. Thank you for
the help.

Aha, so you are watching another application's window? This most likely
takes you out of the realm of what will be 'straightforward' to do in
VB.NET (or in .NET period) - it will involve API calls, I'm fairly
sure. You might try asking in general terms how to do this in one of
the win32 groups, although their answers will probably be in C++, so be
prepared for that...


Unless of course someone is about to dazzle us with a clean managed
solution?
 
Back
Top