ControlDesigner.CreatePlaceHolderDesignTimeHtml 方法

定义

提供一个简单的矩形占位符表示形式,该表示形式显示该控件的类型和 ID。Provides a simple rectangular placeholder representation that displays the type and ID of the control.

重载

CreatePlaceHolderDesignTimeHtml()

提供一个简单的矩形占位符表示形式,该表示形式显示该控件的类型和 ID。Provides a simple rectangular placeholder representation that displays the type and ID of the control.

CreatePlaceHolderDesignTimeHtml(String)

提供一个简单的矩形占位符表示形式,该表示形式显示该控件的类型和 ID 以及指定的附加说明或信息。Provides a simple rectangular placeholder representation that displays the type and ID of the control, and also additional specified instructions or information.

CreatePlaceHolderDesignTimeHtml()

提供一个简单的矩形占位符表示形式,该表示形式显示该控件的类型和 ID。Provides a simple rectangular placeholder representation that displays the type and ID of the control.

protected:
 System::String ^ CreatePlaceHolderDesignTimeHtml();
protected string CreatePlaceHolderDesignTimeHtml ();
member this.CreatePlaceHolderDesignTimeHtml : unit -> string
Protected Function CreatePlaceHolderDesignTimeHtml () As String

返回

一个字符串,包含提供有关控件的基本信息的设计时 HTML 标记。A string that contains design-time HTML markup providing basic information about the control.

继承者说明

典型的设计模式是尝试通过关联的控件获取 HTML 标记,并在遇到错误时调用 GetErrorDesignTimeHtml(Exception) 方法。The typical design pattern is to try to get HTML markup through the associated control, and then if an error is encountered, call the GetErrorDesignTimeHtml(Exception) method. 如果控件未返回任何标记,则调用 GetEmptyDesignTimeHtml() 方法(如果未重写此方法以提供特定标记),将调用 CreatePlaceHolderDesignTimeHtml() 方法,该方法应包含有关控件的类型和 ID 的信息。If no markup is returned by the control, call the GetEmptyDesignTimeHtml() method, which if it is not overridden to provide specific markup, calls the CreatePlaceHolderDesignTimeHtml() method, which should contain information about the type and ID of the control.

另请参阅

CreatePlaceHolderDesignTimeHtml(String)

提供一个简单的矩形占位符表示形式,该表示形式显示该控件的类型和 ID 以及指定的附加说明或信息。Provides a simple rectangular placeholder representation that displays the type and ID of the control, and also additional specified instructions or information.

protected:
 System::String ^ CreatePlaceHolderDesignTimeHtml(System::String ^ instruction);
protected string CreatePlaceHolderDesignTimeHtml (string instruction);
member this.CreatePlaceHolderDesignTimeHtml : string -> string
Protected Function CreatePlaceHolderDesignTimeHtml (instruction As String) As String

参数

instruction
String

一个字符串,包含要添加到 HTML 输出的文本和标记。A string that contains text and markup to add to the HTML output.

返回

一个字符串,包含提供有关控件的信息的设计时 HTML 标记。A string that contains design-time HTML markup providing information about the control.

示例

下面的代码示例演示如何重写模板化控件设计器中的 GetDesignTimeHtml 方法。The following code example demonstrates how to override the GetDesignTimeHtml method in a templated control designer. 然后,将字符串作为 instruction 参数传递到 CreatePlaceHolderDesignTimeHtml 方法,该方法提供设计时 HTML 标记。A string is then passed as the instruction parameter in a call to the CreatePlaceHolderDesignTimeHtml method, which provides the design-time HTML markup.

此代码示例是为 TemplateGroups 属性提供的更大示例的一部分。This code example is part of a larger example provided for the TemplateGroups property.

// Add instructions to the placeholder view of the control
public override string GetDesignTimeHtml()
{
    return CreatePlaceHolderDesignTimeHtml("Click here and use " +
        "the task menu to edit the templates.");
}
' Add instructions to the placeholder view of the control
Public Overloads Overrides Function GetDesignTimeHtml() As String
    Return CreatePlaceHolderDesignTimeHtml("Click here and use " & _
        "the task menu to edit the templates.")
End Function

继承者说明

典型的设计模式是尝试通过关联的控件获取 HTML 标记,并在遇到错误时调用 GetErrorDesignTimeHtml(Exception) 方法。The typical design pattern is to try to get HTML markup through the associated control, and then if an error is encountered, call the GetErrorDesignTimeHtml(Exception) method. 如果控件未返回任何标记,则调用 GetEmptyDesignTimeHtml() 方法(如果未重写此方法以提供特定标记),将调用 CreatePlaceHolderDesignTimeHtml() 方法,该方法应包含有关控件的类型和 ID 的信息。If no markup is returned by the control, call the GetEmptyDesignTimeHtml() method, which if it is not overridden to provide specific markup, calls the CreatePlaceHolderDesignTimeHtml() method, which should contain information about the type and ID of the control.

另请参阅

适用于