Solved

Is it possible to detect collisions between the different text labels and pictures I am moving around on a larger picture

Posted on 2009-06-29
1
229 Views
Last Modified: 2012-05-07
In the previous question you showed me how to move around labels and pictures on a larger bitmap
is it possible to detect when there is a collision between different bit maps and labels?
0
Comment
Question by:Dov_B
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24739436
Yes there is.

You'll need to keep a collection (List) of all the Labels/PictureBoxes.  Whenever one is dropped, you iterate the list and compare the Bounds() of each with the dropped one:

    *** pseudo code ***
        For Each ctl As Control In yourList
            If (Not (ctl Is droppedControl)) AndAlso (droppedControl.Bounds.IntersectsWith(ctl.Bounds)) Then
                ' ...you have a "collision"...
            End If
       Next

The first check:

    (Not (ctl Is droppedControl))

is there to make sure you don't try to compare a control against itself.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now