LoginViewDesigner.GetEmptyDesignTimeHtml 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當未定義目前範本時,取得在設計階段呈現關聯控制項的替代符號之標記。
protected:
override System::String ^ GetEmptyDesignTimeHtml();
protected override string GetEmptyDesignTimeHtml ();
override this.GetEmptyDesignTimeHtml : unit -> string
Protected Overrides Function GetEmptyDesignTimeHtml () As String
傳回
字串,包含在設計介面上呈現給替代符號的標記文字。
範例
下列程式碼範例示範如何覆寫 GetEmptyDesignTimeHtml 繼承自 LoginViewDesigner 類別的 類別中的 方法,以變更在設計階段衍生自 LoginView 類別的控制面板。 此範例會產生預留位置的標記,其中包含為相關聯控制項定義的所有 RoleGroup 物件名稱。
// Generate the design-time markup for the control
// when the template is empty.
protected override string GetEmptyDesignTimeHtml()
{
// Generate a design-time placeholder containing the names of all
// the role groups.
MyLoginView myLoginViewCtl = (MyLoginView)ViewControl;
RoleGroupCollection roleGroups = myLoginViewCtl.RoleGroups;
string roleNames = null;
// If there are any role groups, form a string of their names.
if (roleGroups.Count > 0)
{
roleNames = "Role Groups: <br /> " +
roleGroups[0].ToString();
for( int rgX = 1; rgX < roleGroups.Count; rgX++ )
roleNames +=
"<br /> " + roleGroups[rgX].ToString();
}
return CreatePlaceHolderDesignTimeHtml( roleNames);
} // GetEmptyDesignTimeHtml
' Generate the design-time markup for the control
' when the template is empty.
Protected Overrides Function GetEmptyDesignTimeHtml() As String
' Generate a design-time placeholder containing the names of all
' the role groups.
Dim myLoginViewCtl As MyLoginView = CType(ViewControl, MyLoginView)
Dim roleGroups As RoleGroupCollection = myLoginViewCtl.RoleGroups
Dim RoleNames As String = Nothing
Dim rgX As Integer
' If there are any role groups, form a string of their names.
If roleGroups.Count > 0 Then
roleNames = "Role Groups: <br /> " & _
roleGroups(0).ToString()
For rgX = 1 To roleGroups.Count - 1
roleNames &= "<br /> " & _
roleGroups(rgX).ToString()
Next rgX
End If
Return CreatePlaceHolderDesignTimeHtml(roleNames)
End Function ' GetEmptyDesignTimeHtml
備註
方法 GetEmptyDesignTimeHtml 會先格式化字串訊息,指定相關聯 LoginView 控制項目前範本的名稱,並指定範本是空的。 然後,會產生 GetEmptyDesignTimeHtml 包含該訊息之預留位置的標記。