Inheritance: IPlatformWindowBox
        public void AddChild(RenderElement renderElem, object owner)
        {
            if (renderElem is RenderBoxBase)
            {
                if (owner is ITopWindowBox)
                {
                    var topWinBox = owner as ITopWindowBox;
                    if (topWinBox.PlatformWinBox == null)
                    {
                        FormPopupShadow popupShadow1 = new FormPopupShadow();
                        popupShadow1.Visible = false;
                        IntPtr handle1 = popupShadow1.Handle; //***


                        //create platform winbox
                        var newForm = new AbstractCompletionWindow();
                        newForm.LinkedParentForm    = this.FindForm();
                        newForm.LinkedParentControl = this;
                        newForm.PopupShadow         = popupShadow1;

                        //TODO:
                        //1. review here=> 300,200
                        //2. how to choose InnerViewportKind

                        UISurfaceViewportControl newSurfaceViewport = this.CreateNewOne(300, 200, InnerViewportKind.GLES);
                        newSurfaceViewport.Location = new System.Drawing.Point(0, 0);
                        newForm.Controls.Add(newSurfaceViewport);
                        renderElem.ResetRootGraphics(newSurfaceViewport.RootGfx);
                        renderElem.SetLocation(0, 0);
                        newSurfaceViewport.AddChild(renderElem);
                        //-----------------------------------------------------
                        IntPtr tmpHandle = newForm.Handle;//force newform to create window handle

                        //-----------------------------------------------------

                        var platformWinBox = new PlatformWinBoxForm(newForm);
                        topWinBox.PlatformWinBox = platformWinBox;
                        platformWinBox.UseRelativeLocationToParent = true;
                        platformWinBox.PreviewVisibilityChanged   += PlatformWinBox_PreviewVisibilityChanged;
                        platformWinBox.PreviewBoundChanged        += PlatformWinBox_PreviewBoundChanged;
                        platformWinBox.BoundsChanged   += PlatformWinBox_BoundsChanged;
                        platformWinBox.VisibityChanged += PlatformWinBox_VisibityChanged;
                        _subForms.Add(newForm);
                    }
                }
                else
                {
                    _rootgfx.AddChild(renderElem);
                }
            }
            else
            {
                _rootgfx.AddChild(renderElem);
            }
        }
        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);
            }
        }
        void UpdateInvalidateAccumArea(PlatformWinBoxForm winform)
        {
            winform.GetLocalBoundsIncludeShadow(out int x, out int y, out int w, out int h);
            if (_hasInvalidateAreaAccum)
            {
                _winBoxAccumInvalidateArea = PixelFarm.Drawing.Rectangle.Union(
                    new PixelFarm.Drawing.Rectangle(x, y, w, h),
                    _winBoxAccumInvalidateArea);
            }
            else
            {
                _winBoxAccumInvalidateArea =
                    new PixelFarm.Drawing.Rectangle(x, y, w, h);

                _hasInvalidateAreaAccum = true;
            }
        }
 public void AddContent(RenderElement vi, object owner)
 {
     if (vi is RenderBoxBase)
     {
         if (owner is ITopWindowBox)
         {
             var topWinBox = owner as ITopWindowBox;
             if (topWinBox.PlatformWinBox == null)
             {
                 //create platform winbox 
                 var newForm = new AbstractCompletionWindow();
                 newForm.LinkedParentForm = this.FindForm();
                 newForm.LinkedParentControl = this;
                 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);
                 //------------------------------------------------------                       
                 var platformWinBox = new PlatformWinBoxForm(newForm);
                 topWinBox.PlatformWinBox = platformWinBox;
                 platformWinBox.UseRelativeLocationToParent = true;
                 subForms.Add(newForm);
             }
         }
         else
         {
             this.rootgfx.TopWindowRenderBox.AddChild(vi);
         }
     }
     else
     {
         this.rootgfx.TopWindowRenderBox.AddChild(vi);
     }
 }