// called from SelfNavigateComplete() protected void SetBodyText(string text) { if (text == null) { text = String.Empty; } if (!IsHandleCreated) { return; } if (control != null) { IHTMLDocument2 document = control.Document; if (document != null) { _document = document; IHTMLElement body = document.GetBody(); if (body != null) { if (activate) { DoVerb(Interop.OLEIVERB_UIACTIVATE); } body.SetInnerHTML(text); return; } } } }
public virtual void ClearPreviewDocument(bool fEnabled) { previewElement.SetInnerHTML(""); Object backColor; if (fEnabled == false) { backColor = "buttonface"; } else { backColor = ""; } previewDocument.SetBgColor(backColor); }
public void SetBodyText(string text) { if (control != null) { IHTMLDocument2 document = control.GetDocument(); if (document != null) { IHTMLElement body = document.GetBody(); if (body != null) { if (activate) { DoVerb(-4); } body.SetInnerHTML(text); return; } } } this.body = text; }
/////////////////////////////////////////////////////////////////////////// // IStyleBuilderPage Implementation and StyleBuilderPage Overrides /// <include file='doc\ListsStylePage.uex' path='docs/doc[@for="ListsStylePage.ActivatePage"]/*' /> /// <devdoc> /// The page is now the currently active page in the StyleBuilder. /// Be sure to call super.activatePage, so that the page is made visible. /// </devdoc> protected override void ActivatePage() { base.ActivatePage(); // initialize the preview IStyleBuilderPreview preview = null; if (Site != null) { preview = (IStyleBuilderPreview)Site.GetService(typeof(IStyleBuilderPreview)); } if (preview != null) { try { IHTMLElement listsPreviewElem = null; IHTMLElement listItemElem = null; IHTMLElement previewElem = preview.GetPreviewElement(); previewElem.SetInnerHTML(PREVIEW_TEMPLATE); listsPreviewElem = preview.GetElement(PREVIEW_ELEM_ID); if (listsPreviewElem != null) { previewStyle = listsPreviewElem.GetStyle(); } listItemElem = preview.GetElement(PREVIEW_LISTITEM1_ID); if (listItemElem != null) { listItemElem.SetInnerHTML(SR.GetString(SR.LstSP_PreviewText_1)); } listItemElem = preview.GetElement(PREVIEW_LISTITEM2_ID); if (listItemElem != null) { listItemElem.SetInnerHTML(SR.GetString(SR.LstSP_PreviewText_2)); } } catch (Exception) { previewStyle = null; return; } Debug.Assert(previewStyle != null, "Expected to have non-null cached style reference"); // Setup the font from the shared element to reflect settings in the font page try { IHTMLElement sharedElem = preview.GetSharedElement(); IHTMLStyle sharedStyle; string fontValue; if (sharedElem != null) { sharedStyle = sharedElem.GetStyle(); previewStyle.SetTextDecoration(sharedStyle.GetTextDecoration()); previewStyle.SetTextTransform(sharedStyle.GetTextTransform()); fontValue = sharedStyle.GetFont(); if ((fontValue != null) && (fontValue.Length != 0)) { previewStyle.SetFont(fontValue); } else { previewStyle.RemoveAttribute("font", 1); previewStyle.SetFontFamily(sharedStyle.GetFontFamily()); object o = sharedStyle.GetFontSize(); if (o != null) { previewStyle.SetFontSize(o); } previewStyle.SetFontObject(sharedStyle.GetFontObject()); previewStyle.SetFontStyle(sharedStyle.GetFontStyle()); previewStyle.SetFontWeight(sharedStyle.GetFontWeight()); } } } catch (Exception) { } // update initial preview UpdateBulletStylePreview(); UpdateBulletImagePreview(); UpdateBulletPositionPreview(); } }