-
Jul 8th, 2019, 01:56 PM
#1
Thread Starter
Addicted Member
Change .Container dinamically
Hi guys! Im developing a Custom Control (a form scroller) where it present scrollbars and allow to scroll the controls wich are inside a picturebox.
When I put my custom control on a form it allow to be used as a Container, but the problem is that every control I add is bound to the Usercontrol and not to the picturebox that scroll inside.
I tried changing the container of the added objects to the picturebox with this code:
Code:
Dim o As Object
For Each o In UserControl.ContainedControls
Set o.Container = picPicture
Next
but that dosn't seem to work. Any ideas if its posible ?
-
Jul 8th, 2019, 10:58 PM
#2
Re: Change .Container dinamically
It is not possible.
You can't change the container of a control that its parent is a Form to a container inside an UserControl (you would need to change the Parent).
In the past I've tried with the API SetParent but it worked with problems.
Here I just posted a control that does that but changing the position of each individual control.
-
Jul 9th, 2019, 01:31 AM
#3
Thread Starter
Addicted Member
Re: Change .Container dinamically
Thanks you Eduardo! Seems your control does exactly what I was doing. (wanted scroll to be able to be used in desing mode)
With your permision I want to use is as the base of my control. (I will port a few things from my control like .top,.left and an event when user scrolled it to the bottom)
-
Jul 9th, 2019, 01:31 AM
#4
Thread Starter
Addicted Member
Re: Change .Container dinamically
Thanks you Eduardo! Seems your control does exactly what I was doing. (wanted scroll to be able to be used in desing mode)
With your permision I want to use is as the base of my control. (I will port a few things from my control like .top,.left and an event when user scrolled it to the bottom)
-
Jul 9th, 2019, 01:45 AM
#5
Re: Change .Container dinamically
Originally Posted by shagratt
Thanks you Eduardo! Seems your control does exactly what I was doing. (wanted scroll to be able to be used in desing mode)
With your permision I want to use is as the base of my control. (I will port a few things from my control like .top,.left and an event when user scrolled it to the bottom)
Yes, of course, you can use it as you want.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|