LoginDesigner.GetErrorDesignTimeHtml(Exception) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供发生错误后在设计时呈现关联控件的标记。
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
参数
返回
一个字符串,包含发生错误后在设计时呈现关联 Login 的标记。
示例
下面的代码示例演示如何重写 GetErrorDesignTimeHtml 从 类继承的类中的 方法, LoginDesigner 以在设计时更改派生自 控件的 Login 控件的外观。 该示例为包含以红色粗体文本呈现的错误消息的占位符生成标记。
// 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
注解
设计时 Login 控件呈现的占位符包含类型名称、控件名称以及通知和描述错误的消息。