PictureBox And MousePosition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarcosGalarza
    New Member
    • May 2010
    • 6

    PictureBox And MousePosition

    Hello,

    I have made my picturebox move with my mouse, but I am trying to make the cursor stay in the middle of the picturebox while moving the cursor and picturebox. In other words I want the cursor to stay in the middle of the picture box at all times. What I am trying to do is create a sniper game in VB. I want the Cursor to be in the middle of the crosshair.

    Someone Please Help Me!
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    dear,

    Just create a *.ico file with a ico editor (like "Icofx" = good freeware) and set the background= transparent.
    put it in an imagebox and set visible=no. (see attachment).

    set:

    Code:
    Private Sub Form_Load()
       Screen.MousePointer = 99
       Screen.MouseIcon = Image1.Picture
    End Sub
    PS: no need to set the hotspot for the cursor : it's default in the center!

    Hope this will help You.

    br,
    Attached Files

    Comment

    • MarcosGalarza
      New Member
      • May 2010
      • 6

      #3
      No its not working out for me, when i try to upload the ico file to me resources it does not show up. See what I am trying to do is for the whole screen to be black except for one part: which is the scope. I dont know if you have played Cod, its just like Cod when you scope into a sniper scope. Thats what I am trying to do.

      Comment

      • Guido Geurs
        Recognized Expert Contributor
        • Oct 2009
        • 767

        #4
        dear,


        In this case You have to create your own control (see attachment).
        His size must be at least 2x the size of your application !!
        Use this control in your project (see attachment).

        Sorry for the visual shortcomings but the attached examples are roughly and only for testing.
        You will need to tune dimensions and shapes.

        br,
        Attached Files

        Comment

        Working...