Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
237 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 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