CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010

    PictureBoxes Intersection in C-sharp

    Hello All.

    I have just started to study C-Sharp and i'm having trouble checking if 2 picture boxes intersect each other.

    I wrote this code:

    if (pictureBox1.ClientRectangle.IntersectsWith(pictureBox2.ClientRectangle))
    MessageBox.Show("PictureBoxes Intersect each other");

    but the answer seems to be True always, even if the two pictureboxes are on other sides of the forum...
    Please help me.
    I am using Visual Studio 2008.

    Thank you.

  2. #2
    Join Date
    Jun 2001
    Melbourne/Aus (C# .Net 4.0)

    Re: PictureBoxes Intersection in C-sharp

    Put a break point and check out the two ClientRectangle values. See if they are what you think they are. They maybe relative to the individual PictureBox... not sure... Check their values...
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.