EditorPartChrome.RenderPartContents(HtmlTextWriter, EditorPart) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
渲染控制項的主要 EditorPart 內容區域,但不包含頁首和頁尾。
protected:
virtual void RenderPartContents(System::Web::UI::HtmlTextWriter ^ writer, System::Web::UI::WebControls::WebParts::EditorPart ^ editorPart);
protected virtual void RenderPartContents(System.Web.UI.HtmlTextWriter writer, System.Web.UI.WebControls.WebParts.EditorPart editorPart);
abstract member RenderPartContents : System.Web.UI.HtmlTextWriter * System.Web.UI.WebControls.WebParts.EditorPart -> unit
override this.RenderPartContents : System.Web.UI.HtmlTextWriter * System.Web.UI.WebControls.WebParts.EditorPart -> unit
Protected Overridable Sub RenderPartContents (writer As HtmlTextWriter, editorPart As EditorPart)
參數
- writer
- HtmlTextWriter
那 HtmlTextWriter 個接收 editorPart 內容的人。
- editorPart
- EditorPart
目前正在渲染的控制。
範例
以下程式碼範例示範如何覆寫 RenderPartContents 將文字加入編輯器部分的方法。 關於執行範例所需的完整程式碼,包括用於承載這些控制項的網頁,請參閱類別總覽中的 EditorPartChrome 範例部分。
protected override void RenderPartContents(HtmlTextWriter writer, EditorPart editorPart)
{
writer.AddStyleAttribute("color", "red");
writer.RenderBeginTag("p");
writer.Write("Apply all changes");
writer.RenderEndTag();
editorPart.RenderControl(writer);
}
Protected Overrides Sub RenderPartContents(ByVal writer As System.Web.UI.HtmlTextWriter, ByVal editorPart As System.Web.UI.WebControls.WebParts.EditorPart)
writer.AddStyleAttribute("color", "red")
writer.RenderBeginTag("p")
writer.Write("Apply all changes")
writer.RenderEndTag()
editorPart.RenderControl(writer)
End Sub
備註
此 RenderPartContents 方法允許你覆寫 的 editorPart主體區域渲染,同時保留標頭與頁尾的渲染為預設渲染。
給繼承者的注意事項
你可以選擇性地覆蓋這個 RenderPartContents(HtmlTextWriter, EditorPart) 方法。 如果是這樣,你可以直接對 做任何渲染 editorPart自訂,然後呼叫它的方法 RenderControl(HtmlTextWriter) 。