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
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 86

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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