public void AddContent(RenderElement vi, object owner)
{
if (vi is RenderBoxBase)
{
if (owner is ITopWindowBox)
{
var topWinBox = owner as ITopWindowBox;
if (topWinBox.PlatformWinBox == null)
{
FormPopupShadow2 popupShadow1 = new FormPopupShadow2();
IntPtr handle1 = popupShadow1.Handle;
//create platform winbox
var newForm = new AbstractCompletionWindow();
newForm.LinkedParentForm = this.FindForm();
newForm.LinkedParentControl = this;
newForm.PopupShadow = popupShadow1;
UISurfaceViewportControl newSurfaceViewport = this.CreateNewOne(300, 200);
newSurfaceViewport.Location = new System.Drawing.Point(0, 0);
newForm.Controls.Add(newSurfaceViewport);
vi.ResetRootGraphics(newSurfaceViewport.RootGfx);
vi.SetLocation(0, 0);
newSurfaceViewport.AddContent(vi);
//-----------------------------------------------------
s_tmpHandle = newForm.Handle;//force newform to create window handle
//----------
var platformWinBox = new PlatformWinBoxForm(newForm);
topWinBox.PlatformWinBox = platformWinBox;
platformWinBox.UseRelativeLocationToParent = true;
subForms.Add(newForm);
s_tmpHandle = IntPtr.Zero;
}
}
else
{
this.rootgfx.TopWindowRenderBox.AddChild(vi);
}
}
else
{
this.rootgfx.TopWindowRenderBox.AddChild(vi);
}
}