Home All Groups Group Topic Archive Search About

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

Author
4 Dec 2006 8:24 PM
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....

Author
4 Dec 2006 8:36 PM
lord.zoltar
Marc wrote:
> 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?
Author
4 Dec 2006 8:43 PM
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



lord.zol***@gmail.com wrote:
Show quoteHide quote
> Marc wrote:
> > 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?
Author
4 Dec 2006 8:47 PM
Mudhead
Something like this:

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


<lord.zol***@gmail.com> wrote in message
Show quoteHide quote
news:1165264587.784878.317400@f1g2000cwa.googlegroups.com...
>
> Marc wrote:
>> 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?
>
Author
5 Dec 2006 5:32 AM
Cor Ligthert [MVP]
Thanks I did not know this one.

Cor

Show quoteHide quote
"Mudhead" <noth***@yourhouse.com> schreef in bericht
news:OvSD4V%23FHHA.4652@TK2MSFTNGP04.phx.gbl...
> Something like this:
>
> If Button1.Bounds.IntersectsWith(Button2.Bounds) Then
>      Debug.WriteLine("Yep")
> End If
>
>
> <lord.zol***@gmail.com> wrote in message
> news:1165264587.784878.317400@f1g2000cwa.googlegroups.com...
>>
>> Marc wrote:
>>> 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?
>>
>
>