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
230 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

911 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

19 Experts available now in Live!

Get 1:1 Help Now