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!
Loading
Scott LyslePosted Apr 7, 2008, 4:28 PM
Look at the location test; you are using an assignment operator; it should be == instead of =:
(this works)
if (ball.Location == new System.Drawing.Point(26, 156)) { MessageBox.Show("Match"); } else { MessageBox.Show("No Match"); }