LayoutFarm.CustomWidgets.HtmlBox.LoadHtmlString C# (CSharp) Method

LoadHtmlString() public method

public LoadHtmlString ( string htmlString ) : void
htmlString string
return void
        public void LoadHtmlString(string htmlString)
        {
            if (htmlRenderBox == null)
            {
                this.waitingContentKind = WaitingContentKind.HtmlString;
                this.waitingHtmlString = htmlString;
            }
            else
            {
                //just parse content and load 
                this.myHtmlCont = HtmlContainerHelper.CreateHtmlContainerFromFullHtml(this.htmlhost, htmlString, htmlRenderBox);
                SetHtmlContainerEventHandlers();
                ClearWaitingContent();
            }
        }
        public void LoadHtmlFragmentString(string fragmentHtmlString)

Usage Example

Example #1
0
        protected override void OnStartModule()
        {
            var htmlBox = new HtmlBox(htmlHost, 500, 40);
            viewport.AddContent(htmlBox);
            //design buttons here 

            string htmltext = @"<html><head></head><body id='body_elem'>
                <span id='cmd_box' style='padding:2px'>Box</span>
                <span id='cmd_rect' style='padding:2px'>Rect</span>   
                <span id='cmd_img' style='padding:2px'>Image</span>                 
            </body></html>";
            htmlBox.LoadHtmlString(htmltext);
            var dom1 = htmlBox.HtmlContainer.WebDocument as LayoutFarm.WebDom.IHtmlDocument;
            if (dom1 != null)
            {
                var bodyElemet = dom1.getElementById("body_elem");
                bodyElemet.attachEventListener("mousedown", e =>
                {
                    var srcElement = e.ExactHitObject;
                    HtmlBoxes.CssRun run = srcElement as HtmlBoxes.CssRun;
                    if (run != null)
                    {
                        menuItemClick(this, new MenuItemClickEventArgs(run.Text));
                    }
                    e.StopPropagation();
                });
            }
        }
All Usage Examples Of LayoutFarm.CustomWidgets.HtmlBox::LoadHtmlString