Click here to Skip to main content
15,937,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

hello
I have two picturebox in my form that their shape is car and I can control their by keyboard ans mouse I want that when one of cars is near other one point can receive actually when 2 car accident one point can receive thank you very much
Posted

1 solution

If you are talking about collision detection, then it can be quite complex. However, since you are using pictureboxes (which are rectangles) your code can be a lot simpler:
PictureBox myCar = new PictureBox();
PictureBox yourCar = new PictureBox();
...
if (myCar.Bounds.IntersectsWith(yourCar.Bounds))
    {
    // Bang!
    }
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 2-Aug-11 1:02am    
Nice answer, my 5. However, I can imagine how bad this code is. Using PictureBox along is quite a bad sign.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900