LoadHtmlFragmentString() public method

public LoadHtmlFragmentString ( string fragmentHtmlString ) : void
fragmentHtmlString string
return void
Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.sampleViewport = viewport;
            imageContentMan = new ContentManagers.ImageContentManager();
            imageContentMan.ImageLoadingRequest += (s, e) =>
            {
                e.SetResultImage(LoadBitmap(e.ImagSource));
            };
            //init host 
            myHtmlHost = HtmlHostCreatorHelper.CreateHtmlHost(viewport,
              (s, e) => this.imageContentMan.AddRequestImage(e.ImageBinder),
              (s, e) => { });
            //-----------------------------------------------------

            this.groundHtmlBox = new HtmlBox(myHtmlHost, 800, 600);
            string html = @"<div></div>";
            //if you want to use full html-> use HtmlBox instead  

            this.sampleViewport.AddContent(groundHtmlBox);
            //----------------------------------------------------- 
            groundHtmlBox.LoadHtmlFragmentString(html);
            this.groundHtmlDoc = groundHtmlBox.HtmlContainer.WebDocument as HtmlDocument;
            OnHtmlHostCreated();
        }