protected override void OnStartDemo(SampleViewport viewport) { ////================================================== //html box var htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null); var htmlBox = new HtmlBox(htmlHost, 800, 400); StringBuilder stbuilder = new StringBuilder(); stbuilder.Append("<html><head></head><body>"); stbuilder.Append("<div>custom box1</div>"); stbuilder.Append("<x id=\"my_custombox1\"></x>"); stbuilder.Append("<div>custom box2</div>"); stbuilder.Append("<x type=\"textbox\" id=\"my_custombox1\"></x>"); stbuilder.Append("</body></html>"); htmlBox.LoadHtmlString(stbuilder.ToString()); viewport.AddContent(htmlBox); //================================================== //textbox var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true); textbox.SetLocation(0, 200); viewport.AddContent(textbox); textbox.Focus(); }
protected override void OnStartDemo(SampleViewport viewport) { var htmlhost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null); ////================================================== //html box var htmlBox = new HtmlBox(htmlhost, 800, 400); htmlBox.SetLocation(30, 30); viewport.AddContent(htmlBox); string html = @"<html><head></head><body><div>OK1</div><div>OK2</div></body></html>"; htmlBox.LoadHtmlString(html); //================================================== //textbox var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 100, true); textbox.SetLocation(0, 200); viewport.AddContent(textbox); textbox.Focus(); }
protected override void OnStart(AppHost host, IGameHTMLUI pcx) { htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(host, null, null); ////================================================== //html box { HtmlBox lightHtmlBox = new HtmlBox(htmlHost, 800, 50); lightHtmlBox.SetLocation(50, 450); host.AddChild(lightHtmlBox); //light box can't load full html //all light boxs of the same lightbox host share resource with the host string html = @"<div>OK1</div><div>OK2</div>"; //if you want to use full html-> use HtmlBox instead lightHtmlBox.LoadHtmlFragmentString(html); } //================================================== { HtmlBox lightHtmlBox2 = new HtmlBox(htmlHost, 800, 50); lightHtmlBox2.SetLocation(0, 60); host.AddChild(lightHtmlBox2); //light box can't load full html //all light boxs of the same lightbox host share resource with the host string html2 = @"<div>OK3</div><div>OK4</div>"; //if you want to use ful l html-> use HtmlBox instead lightHtmlBox2.LoadHtmlFragmentString(html2); } //================================================== { HtmlBox lightHtmlBox3 = new HtmlBox(htmlHost, 800, 50); lightHtmlBox3.SetLocation(0, 100); host.AddChild(lightHtmlBox3); //fragment dom //create dom then to thie light box lightHtmlBox3.LoadHtmlDom(CreateSampleHtmlDoc()); } //================================================== //textbox var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 150, true); textbox.SetLocation(0, 200); host.AddChild(textbox); textbox.Focus(); }
protected override void OnStartDemo(SampleViewport viewport) { htmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport, null, null); ////================================================== //html box { HtmlBox lightHtmlBox = new HtmlBox(htmlHost, 800, 50); lightHtmlBox.SetLocation(50, 450); viewport.AddContent(lightHtmlBox); //light box can't load full html //all light boxs of the same lightbox host share resource with the host string html = @"<div>OK1</div><div>OK2</div>"; //if you want to use full html-> use HtmlBox instead lightHtmlBox.LoadHtmlFragmentString(html); } //================================================== { HtmlBox lightHtmlBox2 = new HtmlBox(htmlHost, 800, 50); lightHtmlBox2.SetLocation(0, 60); viewport.AddContent(lightHtmlBox2); //light box can't load full html //all light boxs of the same lightbox host share resource with the host string html2 = @"<div>OK3</div><div>OK4</div>"; //if you want to use ful l html-> use HtmlBox instead lightHtmlBox2.LoadHtmlFragmentString(html2); } //================================================== { HtmlBox lightHtmlBox3 = new HtmlBox(htmlHost, 800, 50); lightHtmlBox3.SetLocation(0, 100); viewport.AddContent(lightHtmlBox3); //fragment dom //create dom then to thie light box lightHtmlBox3.LoadHtmlDom(CreateSampleHtmlDoc()); } //================================================== //textbox var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 150, true); textbox.SetLocation(0, 200); viewport.AddContent(textbox); textbox.Focus(); }