Moving cursor position

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts Page 1 of 1
Contributors
User avatar
Bogoh67
VIP - Site Partner
VIP - Site Partner
Posts: 656
Joined: Sun Apr 18, 2010 8:20 pm

Moving cursor position
Bogoh67
So i want an image to follow the cursor and i mean directly behind it
But when i run the program the image is extremely off
current code im using
Code: Select all
 PictureBox1.Location = New Point(MousePosition.X, MousePosition.Y)
i have used
Code: Select all
 PictureBox1.Location = MousePosition
neither work
Please help
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Moving cursor position
M1z23R
You should use your form's move event, not picturebox's.
type under the public class Form1 : Protected overrides onmousemove - press enter
then add picturebox1.location=new point(e.x,e.y)
User avatar
Bogoh67
VIP - Site Partner
VIP - Site Partner
Posts: 656
Joined: Sun Apr 18, 2010 8:20 pm

Re: Moving cursor position
Bogoh67
Doesn't work. Maybe i did it wrong but this is what happened
Code: Select all
 Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
        MyBase.OnMouseMove(e)
        PictureBox1.Location = New Point(MousePosition.X, MousePosition.Y)
    End Sub
I don't know if this changes anything, but here is my forms changed settings
Code: Select all
AutoScaleMode-Font
BackColor-WindowFrame
ForeColor-WindowFrame
FormBorderStyle-None
ShowInTaskbar-False
Size-ScreenSize
StartPosition-CenterScreen
Text-FullScreen
TopMost-True
TransparancyKey-WindowsFrame
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Moving cursor position
M1z23R
Do you want to move your form all over the screen, or picturebox inside the form ?
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Moving cursor position
Dummy1912
maybe with
Code: Select all
Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
        MyBase.OnMouseMove(e)
        PictureBox1.Location = New Point(e.Location.X, e.Location.Y)
    End Sub
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
lolxot
VIP - Donator
VIP - Donator
Posts: 155
Joined: Thu Apr 08, 2010 4:59 pm

Re: Moving cursor position
lolxot
hey
I'm currently @ school so I can't look up the code but I have made a game where this code is used: viewtopic.php?f=71&t=9468

Just download the source and search for the mousemove event
User avatar
Bogoh67
VIP - Site Partner
VIP - Site Partner
Posts: 656
Joined: Sun Apr 18, 2010 8:20 pm

Re: Moving cursor position
Bogoh67
I actually fixed it myself. The reason why it was happening was because the start position of the form.
7 posts Page 1 of 1
Return to “Coding Help & Support”