SBendBuckeye
Programmer
Hello all,
We have a custom container control that has some controls added to it automatically by a custom designer. The designer sets some default properties for the embedded controls using code similar to the following:
The embedded controls are exposed as properties in the custom control so they are available at Design time with code similar to the following:
Additionally, some requested embedded control properties are exposed as properties in the custom container control itself with code similar to the following:
Since these changes to the embedded controls are all taking place at different times in the Design time environment, I am not sure when or even if I should be raising the OnComponentChanging and OnComponentChanged events.
1. Do I need to raise the OnComponentChanging and OnComponentChanged events in custom designer code
a. When I create the embedded controls in the custom container control
b. When I change embedded control properties in the custom designer after they have been created
2. Do I need to raise the OnComponentChanging and OnComponentChanged events in the custom container control for the embedded controls themselves (eg MyEmbeddedControl above)
3. Do I need to raise the OnComponentChanging and OnComponentChanged events in the custom container control for embedded control properties which have been exposed in the custom container control (eg MyEmbeddedControlBackColor above)
If someone could explain this a bit for me, I would greatly appreciate it! Thanks in advance for any ideas and/or suggestions!
We have a custom container control that has some controls added to it automatically by a custom designer. The designer sets some default properties for the embedded controls using code similar to the following:
Code:
With TypeDescriptor.GetProperties(component).Find(name, True)
.SetValue(component, value)
End With
Code:
Private m_MyEmbeddedControl As CheckBox = Nothing
Public Property MyEmbeddedControl As CheckBox
Get
Return m_MyEmbeddedControl
End Get
Set(ByVal value As CheckBox)
m_MyEmbeddedControl = value
End Set
End Property 'MyEmbeddedControl
Code:
Public Property MyEmbeddedControlBackColor As Color
Get
Return Me.MyEmbeddedControl.BackColor
End Get
Set(ByVal value As Color)
Me.MyEmbeddedControl.BackColor = value
End Set
End Property 'MyEmbeddedControlBackColor
1. Do I need to raise the OnComponentChanging and OnComponentChanged events in custom designer code
a. When I create the embedded controls in the custom container control
b. When I change embedded control properties in the custom designer after they have been created
2. Do I need to raise the OnComponentChanging and OnComponentChanged events in the custom container control for the embedded controls themselves (eg MyEmbeddedControl above)
3. Do I need to raise the OnComponentChanging and OnComponentChanged events in the custom container control for embedded control properties which have been exposed in the custom container control (eg MyEmbeddedControlBackColor above)
If someone could explain this a bit for me, I would greatly appreciate it! Thanks in advance for any ideas and/or suggestions!