|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Overlapping controlsI have a form with 2 custom controls that can be dragged around by a
user. How can I check if they overlap each other without performing some kind of Collision detection on them? Is there anything in GDI to check for overlapping controls? Yes, it's called math.
If one of the controls' left property is < another controls' left property + it's width property, guess what, the former is overlapping the latter (in checking for the x location only). Do the math for the rest. HTH Steve Show quoteHide quote "Charlie Brown" <cbr***@duclaw.com> wrote in message news:1160149269.696373.105170@k70g2000cwa.googlegroups.com... >I have a form with 2 custom controls that can be dragged around by a > user. How can I check if they overlap each other without performing > some kind of Collision detection on them? Is there anything in GDI to > check for overlapping controls? > Thank you for your sarcastic reply Steve. Some of my controls are not
rectangles, so checking for overlaps using math becomes a bit more complex than simple addition. I was looking to see if there was something built into the framework that already did the check, for example, checking z order on overlapping controls or something similar. I have done collision detection classes before, but looking for an existing solution before beginning is usually the more productive way to code software. In the future when you reply to someone, curb the sarcasm, and put some thought into your answer. Although I didn't mention whether I was testing for rectangles or not, you could have asked. Steve Long wrote: Show quoteHide quote > Yes, it's called math. > If one of the controls' left property is < another controls' left property + > it's width property, guess what, the former is overlapping the latter (in > checking for the x location only). Do the math for the rest. > > HTH > Steve > > "Charlie Brown" <cbr***@duclaw.com> wrote in message > news:1160149269.696373.105170@k70g2000cwa.googlegroups.com... > >I have a form with 2 custom controls that can be dragged around by a > > user. How can I check if they overlap each other without performing > > some kind of Collision detection on them? Is there anything in GDI to > > check for overlapping controls? > > Charlie,
Take a look at this: http://msdn.microsoft.com/msdnmag/issues/04/01/AdvancedBasics/ Show quoteHide quote "Charlie Brown" <cbr***@duclaw.com> wrote in message news:1160172912.346014.180070@h48g2000cwc.googlegroups.com... > Thank you for your sarcastic reply Steve. Some of my controls are not > rectangles, so checking for overlaps using math becomes a bit more > complex than simple addition. I was looking to see if there was > something built into the framework that already did the check, for > example, checking z order on overlapping controls or something similar. > I have done collision detection classes before, but looking for an > existing solution before beginning is usually the more productive way > to code software. > > In the future when you reply to someone, curb the sarcasm, and put some > thought into your answer. Although I didn't mention whether I was > testing for rectangles or not, you could have asked. > > > Steve Long wrote: >> Yes, it's called math. >> If one of the controls' left property is < another controls' left >> property + >> it's width property, guess what, the former is overlapping the latter (in >> checking for the x location only). Do the math for the rest. >> >> HTH >> Steve >> >> "Charlie Brown" <cbr***@duclaw.com> wrote in message >> news:1160149269.696373.105170@k70g2000cwa.googlegroups.com... >> >I have a form with 2 custom controls that can be dragged around by a >> > user. How can I check if they overlap each other without performing >> > some kind of Collision detection on them? Is there anything in GDI to >> > check for overlapping controls? >> > > Charlie,
Overlapping controls is allowed, so it would be strange if there was a check for that. It is often used to hide controls or even more by using the splitter. Cor Show quoteHide quote "Charlie Brown" <cbr***@duclaw.com> schreef in bericht news:1160172912.346014.180070@h48g2000cwc.googlegroups.com... > Thank you for your sarcastic reply Steve. Some of my controls are not > rectangles, so checking for overlaps using math becomes a bit more > complex than simple addition. I was looking to see if there was > something built into the framework that already did the check, for > example, checking z order on overlapping controls or something similar. > I have done collision detection classes before, but looking for an > existing solution before beginning is usually the more productive way > to code software. > > In the future when you reply to someone, curb the sarcasm, and put some > thought into your answer. Although I didn't mention whether I was > testing for rectangles or not, you could have asked. > > > Steve Long wrote: >> Yes, it's called math. >> If one of the controls' left property is < another controls' left >> property + >> it's width property, guess what, the former is overlapping the latter (in >> checking for the x location only). Do the math for the rest. >> >> HTH >> Steve >> >> "Charlie Brown" <cbr***@duclaw.com> wrote in message >> news:1160149269.696373.105170@k70g2000cwa.googlegroups.com... >> >I have a form with 2 custom controls that can be dragged around by a >> > user. How can I check if they overlap each other without performing >> > some kind of Collision detection on them? Is there anything in GDI to >> > check for overlapping controls? >> > >
vb 6.0 naar vb.net 2005
Dynamic mapping string to function creating pictureboxes on the fly How to determen the object ? WEB combobox won't fire event NullReferenceException with shared members Website local/remote login Access My.Settings from class library crash at closue msvbvm60.dll Bring my FORM to front?? |
|||||||||||||||||||||||