Move the Picture on Movement of Cursor

Move the picture on movement of cursor

Here is a procedure to move picture on movement of cursor.

Steps are as follows:

1. Open visual studio 2010 then click on "File" > "New" > "Project".

Image-1.jpg

2. Then select "Windows Form Application" in visual c#.

Image-2.jpg
  
3. Give the name of the application.

4. Drag and Drop "PictureBox" and "Timer" on the Form.

Image-3.jpg

5. Now go to the "Properties of Timer" and Set behavior "Enabled as True".

Image-4.jpg

6. Now Choose an "Image for PictureBox".

Image-5.jpg

And import a pic from the computer.

Image-6.jpg

Now on the Timer's "Tick Event". Write the following code.

private void timer1_Tick(object sender, EventArgs e)

{

pictureBox1.Location = new Point(Cursor.Position.X,Cursor.Position.Y);

} 

Ebook Download
View all
Learn
View all
sourabhsomani.com