public HtmlMonoGamePanelControl GetPanel(IGameHTMLUI pcx) { _pcx = pcx; //1. create blank form YourImplementation.DemoFormCreatorHelper.CreateReadyForm( InnerViewportKind.MonoGame, out _viewroot, out _latest_formCanvas, _pcx.UI, _pcx); //_userInterface.UseRenderTarget = false; //_userInterface.AddEntity(_latest_formCanvas); AppHost appHost = new AppHost(_pcx); AppHostConfig config = new AppHostConfig(); //YourImplementation.UISurfaceViewportSetupHelper.SetUISurfaceViewportControl(config, _viewroot); appHost.Setup(config); /*_latest_formCanvas.FormClosed += (s, e) => * { * //when owner form is disposed * //we should clear our resource? * app.OnClosing(); * app.OnClosed(); * _latest_formCanvas = null; * _viewroot = null; * };*/ //2. create app host appHost.StartApp(this); //_viewroot.TopDownRecalculateContent(); //================================================== if (false) //true) //this.chkShowLayoutInspector.Checked) { ///YourImplementation.LayoutInspectorUtils.ShowFormLayoutInspector(_viewroot); } return(_latest_formCanvas); }