通过MouseEnter事件判断即可。
为了更人性化,你可以设置下图片的安全区域。
定义图片类型。
public enum TargetType
{
General = 0, // 普通图片,
Bomb = 1, //移动炸弹
Point =2 //加分
}
自定义类,添加以下属性,类可以从PictureBox继承。
private TargetType m_TargetType =TargetType.General;
public TargetType TargetType
{
get{ return m_TargetType;}
set{ m_TargetType =value;}
}
MouseEnter事件中,判断下图片类型
如果是Bomb炸弹,Show Game Over
根据屏幕坐标,picturebox的坐标和鼠标的坐标,来判断是不是picturebox和鼠标重叠在一起
picturebox控件的事件列表里有这样一个事件!
当鼠标进入控件可视范围内时发生!名字叫MouseEnter
picturebox+=mousemove(s,e)
{
//游戏结束
};