本文介绍了C#中的2个图片框在汽车形状中发生事故的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


你好
我有两个图片框,它们的形状是汽车,我可以通过键盘和鼠标来控制它们.我希望当一辆汽车靠近另一点时,当两车祸发生时,一点可以接收到.实际上,谢谢你


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

推荐答案

PictureBox myCar = new PictureBox();
PictureBox yourCar = new PictureBox();
...
if (myCar.Bounds.IntersectsWith(yourCar.Bounds))
    {
    // Bang!
    }


这篇关于C#中的2个图片框在汽车形状中发生事故的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 06:37