語言

LoginViewDesigner.GetErrorDesignTimeHtml(Exception) 方法

定義

提供標記,在設計時發生錯誤時渲染相關控制。

protected:
 override System::String ^ GetErrorDesignTimeHtml(Exception ^ e);
protected override string GetErrorDesignTimeHtml(Exception e);
override this.GetErrorDesignTimeHtml : Exception -> string
Protected Overrides Function GetErrorDesignTimeHtml (e As Exception) As String

參數

e
Exception

然後 Exception 被丟掉了。

傳回

包含標記的字串,用於在錯誤發生後渲染設計時的相關標記 LoginView 。

範例

以下程式碼範例說明如何覆寫 GetErrorDesignTimeHtml 從該類別繼承 LoginViewDesigner 的方法,以改變設計時從類別衍生出 LoginView 的控制項外觀。 範例中會產生包含錯誤訊息的佔位符標記,該錯誤訊息以紅色粗體字呈現。

// Generate the design-time markup for the control when an error occurs.
protected override string GetErrorDesignTimeHtml(Exception ex) 
{
    // Write the error message text in red, bold.
    string errorRendering =
        "<span style=\"font-weight:bold; color:Red; \">" +
        ex.Message + "</span>";

    return CreatePlaceHolderDesignTimeHtml(errorRendering);
} // GetErrorDesignTimeHtml
' Generate the design-time markup for the control when an error occurs.
Protected Overrides Function GetErrorDesignTimeHtml( _
    ByVal ex As Exception) As String

    ' Write the error message text in red, bold.
    Dim errorRendering As String = _
        "<span style=""font-weight:bold; color:Red; "">" & _
        ex.Message & "</span>"

    Return CreatePlaceHolderDesignTimeHtml(errorRendering)

End Function ' GetErrorDesignTimeHtml

備註

錯誤設計時 LoginView 控制會以面板形式呈現,包含型別名稱、控制名稱,以及宣告和描述錯誤的訊息。

適用於

另請參閱