MenuDesigner.GetEmptyDesignTimeHtml 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得標記,在設計時為相關控制項產生佔位符,當其他標記無法提供時。
protected:
override System::String ^ GetEmptyDesignTimeHtml();
protected override string GetEmptyDesignTimeHtml();
override this.GetEmptyDesignTimeHtml : unit -> string
Protected Overrides Function GetEmptyDesignTimeHtml () As String
傳回
一個包含標記文字的字串,會渲染成設計表面上的佔位符。
範例
以下程式碼範例展示了如何在繼承自該GetEmptyDesignTimeHtml類別的類別中覆寫該MenuDesigner方法。 覆寫後的方法會在設計時改變從 Menu 類別衍生出的控制項外觀。 範例中會產生一個佔位符的標記,該佔位符包含訊息表示相關控制項未定義選單項目。
// Generate the design-time markup for the control
// when the template is empty.
protected override string GetEmptyDesignTimeHtml()
{
string noElements = "Contains no menu items.";
return CreatePlaceHolderDesignTimeHtml(noElements);
} // GetEmptyDesignTimeHtml
' Generate the design-time markup for the control
' when the template is empty.
Protected Overrides Function GetEmptyDesignTimeHtml() As String
Dim noElements As String = "Contains no menu items."
Return CreatePlaceHolderDesignTimeHtml(noElements)
End Function ' GetEmptyDesignTimeHtml
備註
這個 GetEmptyDesignTimeHtml 方法會產生一個佔位符的標記,該佔位符指定控制名稱, Menu 並有訊息指示你使用集合編輯器來新增項目。