Results 1 to 4 of 4

Thread: Custom cursor from file

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Custom cursor from file

    How to make custom cursor for my application from image file .jpg or .png or .gif
    to work on everything, clicking on buttons, textfields the cursor to be on everything.

    Also can it be done
    Cursor1 - that is the cursor for mouse move on everything
    Cursor2 - when you click on buttons or textfield or other to display other cursor

    Can it be done this effect ? (its like rollover effect)

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Custom cursor from file

    .Paul. has a CursorCreator class that I have used in the past to create cursors from graphics files. I'll let him pass that on, if he wants. Making animated cursors is a bit weirder, but I have some information on that, if it is of interest.

    As for the second part, it can be done, but I'm not quite sure what you want. Changing the cursor on a button click would be a bit weird, as the click tends to happen in short order. Is it supposed to change back or remain the same?

    One thing I have done is to change the cursor on MouseOver. I have a crosshairs cursor which is normally black, but changes to red when the cursor is moved across a button that is a viable target for the cursor.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Re: Custom cursor from file

    i mean default cursor to be Cursor1, but when you mouseover in textbox it shows | icon, to display Cursor1 again instead | , and Cursor2 is when you click with the mouse to display the effect

    i can show images:
    Cursor1: default mouse
    http://img535.imageshack.us/img535/6775/cursoriy.png
    Cursor2: when click with mouse
    http://img805.imageshack.us/img805/7996/cursor3.png

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Re: Custom cursor from file

    i managed to make it, but i got 1 bug on the cursor, how to make it on top of the finger to be the mouse to click , couse now its under the hand?

    code:
    Code:
    Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As IntPtr
        Dim g As IntPtr = LoadCursorFromFile("MyCursor.cur")
    
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Cursor = New Cursor(g)
        End Sub
    I made cursor options:
    Build Action: Embedded Resource
    Copy to. : Copy always

    any ideas how to fix it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width