-
Jun 15th, 2021, 09:34 PM
#1
Thread Starter
Junior Member
While in DesignMode drag Item on Control and then Programmatically add another.
I have a Control, inheriting a Panel.
Programmatically I can add another Control as its child, and have the Parent add one more child, and change their size to fit its container.
Now I'm trying to do the same in DesignTime: Dragging a Control on my Control and have the Parent add another child.
I have used onControlAdded to react to the drop, which adds an other Control as it should.
But, their size doesn't change, it stays the defaultsize.
Plus, I can see the dropped Control in View and in the PropertiesBox, but not the programmatically create one.
I don't add an example code, because I suspect the problem is more fundamental.
(the whole approach probably)
But if it would help?
-
Jun 16th, 2021, 07:27 AM
#2
Thread Starter
Junior Member
Re: While in DesignMode drag Item on Control and then Programmatically add another.
Just to zoom in on my more fundamental misunderstanding:
Is it at all possible for a (user)control to tell the designer it has changed the size or position of its children?
Last edited by Black Monkey; Jun 16th, 2021 at 07:28 AM.
Reason: enradable
-
Jun 19th, 2021, 11:06 AM
#3
Re: While in DesignMode drag Item on Control and then Programmatically add another.
Hi Black Monkey,
Maybe it would help if you were to explain what you're trying to achieve rather than how you're trying to do it.
Poppa
Along with the sunshine there has to be a little rain sometime.
-
Jun 19th, 2021, 02:28 PM
#4
Re: While in DesignMode drag Item on Control and then Programmatically add another.
Originally Posted by Black Monkey
Just to zoom in on my more fundamental misunderstanding:
Is it at all possible for a (user)control to tell the designer it has changed the size or position of its children?
Custom Events and RaiseEvent
(In your custom control)
Code:
Class MyControl
Public Event MyEvent(ByVal AParameterIWantToSend As TheTypeOfThisParameter, ByVal AnotherParmeter As AnotherType, ...)
...
End Class
In the Resize or Move event of one of your custom control's child control...
Code:
RaiseEvent MyEvent(arg1, arg2, etc)
In your Form...
Code:
Public Sub MyControl_MyEvent(ByVal AParameterIWantToSend As TheTypeOfThisParameter, ByVal AnotherParmeter As AnotherType, ...) Handles MyControl.MyEvent
'put your 'what to do' on resize or move code here
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 19th, 2021, 06:15 PM
#5
Thread Starter
Junior Member
Re: While in DesignMode drag Item on Control and then Programmatically add another.
@.paul.
Reading back my original question, I think I had better taken an other cup of coffee before posting.
Your code works like a charm, but I meant to ask how (if) a control can relay to a custom designer; that a child has been added, or the control has changed a property of its child.
-
Jun 19th, 2021, 06:35 PM
#6
Thread Starter
Junior Member
Re: While in DesignMode drag Item on Control and then Programmatically add another.
@Poppa Mintin
My goal is; to create a control( parented to a Panel) that, in design-Mode,
when a user drags an item onto it, creates an other item and adds that also as a child.
So, drag (for instance) a panel on the control, and the result will be that the control has two panels as children.
I can code that. But the custom designer, I have added to the control,( so the user can choose some properties of the added item( by smart-tags)), does not notice the second created item.
I could have the user just add two items, but that doesn't feel intuitive.
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
|