ControlDesigner.GetErrorDesignTimeHtml(Exception) メソッド

定義

指定された例外に関する情報を提供する HTML マークアップを取得します。

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

パラメーター

e
Exception

発生した例外。

戻り値

String

指定された例外のデザイン時の HTML マークアップ。

次のコード例は、エラーが発生したときにコントロールのデザイン時 HTML マークアップを生成し、メソッドを呼び出す方法を CreatePlaceHolderDesignTimeHtml 示しています。

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

注釈

メソッドで GetErrorDesignTimeHtml 例外がスローされた場合、通常、メソッドが呼び出されます GetDesignTimeHtml

注意 (継承者)

一般的な設計パターンは、関連するコントロールを介して HTML マークアップを取得し、エラーが発生した場合はメソッドを GetErrorDesignTimeHtml(Exception) 呼び出します。 コントロールからマークアップが返されない場合は、メソッドを GetEmptyDesignTimeHtml() 呼び出します。特定のマークアップを提供するためにオーバーライドされない場合は、メソッドを CreatePlaceHolderDesignTimeHtml() 呼び出します。このメソッドには、コントロールの型と ID に関する情報が含まれている必要があります。

適用対象

こちらもご覧ください