3 Replies - 6093 Views - Last Post: 26 October 2009 - 06:39 AM Rate Topic: -----

#1 snikmotnairb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 70
  • Joined: 02-May 08

Change mouse cursor outside form

Posted 23 October 2009 - 09:47 AM

I have a program that reads pixel colors in other applications, I've got the program working correctly but trying to hovor your mouse over a single pixel on the screen using the standard mouse "Arrow" pointer is a little difficult. I've created a custom cursor that is a cross hair of sorts that makes it easier to target specific pixels, is there a way to change the mouse curse to a specified cursor when the mouse is NOT over the controlling form?

I thought the most obvious answer would be the MouseLeave event like so...

Private Sub MainForm_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave

		Me.Cursor = New Cursor("Custom.cur")

End Sub



but that doesn't seem to work

When my mouse leaves the controlling form, it always changes back to the standard "Arrow" pointer.

Any help is appreciated.

-Brian

Is This A Good Question/Topic? 0
  • +

Replies To: Change mouse cursor outside form

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 428
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: Change mouse cursor outside form

Posted 23 October 2009 - 11:20 AM

You might have to use winapi to set the cursor. Here is the SetCursor function:

http://msdn.microsof...393(VS.85).aspx
Was This Post Helpful? 1
  • +
  • -

#3 snikmotnairb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 70
  • Joined: 02-May 08

Re: Change mouse cursor outside form

Posted 23 October 2009 - 12:49 PM

View Postjanne_panne, on 23 Oct, 2009 - 10:20 AM, said:

You might have to use winapi to set the cursor. Here is the SetCursor function:

http://msdn.microsof...393(VS.85).aspx


I have tried the API functions but didn't seem to have any luck with those either. :(
Was This Post Helpful? 0
  • +
  • -

#4 snikmotnairb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 70
  • Joined: 02-May 08

Re: Change mouse cursor outside form

Posted 26 October 2009 - 06:39 AM

View Postjanne_panne, on 23 Oct, 2009 - 10:20 AM, said:

You might have to use winapi to set the cursor. Here is the SetCursor function:

http://msdn.microsof...393(VS.85).aspx


I figured out how to do this, I did need to use the API functions, I was just using them wrong :crazy:

I have it working now, thanks for your response janne_panne.

For those interested, the SetSystemCursor winapi function does the trick.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1