Hi,
When I drop ChildFormDialog control on form, it will "auto generate code below at designer.cs.
This.ChildFormDialog1.ParentForm = this;
For curiousity, I created a class to "subclass" ChildFormDialog component using association which able to drop on usercontrol..
I would like to auto generate code below when drop to user control.
This.ChildFormDialog.ParentForm = this.ParentForm;
However, It doesnt't work. It always give me code below.
This.ChildFormDialog.ParentForm = null;
How to do this?
My Current Code
[Browsable(false)]
public BaseForm ParentForm
{
get
{
if (_ParentForm == null && this.DesignMode)
{
IDesignerHost loDesigner = (IDesignerHost)this.GetService(typeof(IDesignerHost));
if (loDesigner != null)
{
if (!loDesigner.RootComponent.GetType().IsSubclassOf(typeof(MicroFour.StrataFrame.UI.Windows.Forms.UserControl))
&& loDesigner.RootComponent != this)
{
return _ChildFormDialog.ParentForm;
}
else
{
MicroFour.StrataFrame.UI.Windows.Forms.UserControl loUC = (MicroFour.StrataFrame.UI.Windows.Forms.UserControl)loDesigner.RootComponent;
return (BaseForm)loUC.ParentForm;
}
}
}
return this._ChildFormDialog.ParentForm;
}
set
{
_ParentForm = (BaseForm)value;
this._ChildFormDialog.ParentForm = (BaseForm)value;
}
}