code to find all dynamic control locations on a form???

M

Marc

Hi guys,

I have a selection of dynamically created controls on a form. I want to
be able to check the location of any of these controls and comare them
with the location of another control.
(This is actually to replicate the windows desktop drag-drop
functionality).

As an example I need something like:

If me.Controls.(??any control location????) = theButton.Location

Any ideas how i can do this....
 
L

lord.zoltar

Marc said:
Hi guys,

I have a selection of dynamically created controls on a form. I want to
be able to check the location of any of these controls and comare them
with the location of another control.
(This is actually to replicate the windows desktop drag-drop
functionality).

As an example I need something like:

If me.Controls.(??any control location????) = theButton.Location

Any ideas how i can do this....

Not quite sure what you're asking here...
You have some controls and you want to compare the location of any of
these controls to the locations of all the other controls?

The Location property of the control has an X and Y property which
should help...
exactly how do you want to compare the controls?
 
M

Marc

Its ok..i worked it out

For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is Button And ctrl IsNot theButton And
ctrl.Location = theButton.Location Then
MsgBox("jijj")
End If
Next
End If
 
M

Mudhead

Something like this:

If Button1.Bounds.IntersectsWith(Button2.Bounds) Then
Debug.WriteLine("Yep")
End If
 
C

Cor Ligthert [MVP]

Thanks I did not know this one.

Cor

Mudhead said:
Something like this:

If Button1.Bounds.IntersectsWith(Button2.Bounds) Then
Debug.WriteLine("Yep")
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top