?
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
Medium Priority
?
236 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 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