1
Answer

How to check position of picturebox

John Simoes

John Simoes

16y
3.4k
1
Hey guys, I'm developping a ball in cup game where the user has to guess under what cup the ball is located.

I've used the following code segment to animate the cups:

cupone.Location = new System.Drawing.Point(13, 120);

As you know, this statement draws the picturebox at the specified field. Now, I want to write an if statement that checks if the ball is at the proper location. For instance, this is where I put the ball:

ball.Location = new System.Drawing.Point(26, 156);

if (ball.Location = System.Drawing.Point  (26, 156)) .. so on.. but I get an error that says:

Error    2    'System.Drawing.Region' is a 'type', which is not valid in the given context

How would I proceed to write an if statement check to see if a picturebox is in a certain location?

Thanks guys, much appreciated!


Answers (1)