ControlDesigner.GetDesignTimeHtml メソッド (DesignerRegionCollection)
アセンブリ: System.Design (system.design.dll 内)

Dim instance As ControlDesigner Dim regions As DesignerRegionCollection Dim returnValue As String returnValue = instance.GetDesignTimeHtml(regions)
戻り値
すべてのコントロール デザイナ領域を含む、関連付けられているコントロールのデザイン時 HTML マークアップ。

デザイン ホストは、GetDesignTimeHtml メソッドを呼び出して、デザイン時 HTML マークアップ、および現在のコントロール デザイナ領域のリストを取得します。デザイン ホストは、DesignerRegionCollection を使用して、編集可能な各コントロール デザイナ領域のマークアップを要求できます。
GetDesignTimeHtml メソッドは、GridViewDesigner クラスなど、GetDesignTimeHtml メソッドを呼び出す前に領域の内容を処理する必要がある派生コントロール デザイナ用に用意されています。

DesignerRegionCollection コレクションを使用して HTML マークアップを作成する方法を次のコード例に示します。
' Create the regions and design-time markup. Called by the designer host. Public Overrides Function GetDesignTimeHtml(ByVal regions As DesignerRegionCollection) As String ' Create 3 regions: 2 clickable headers and an editable row regions.Add(New DesignerRegion(Me, "Header0")) regions.Add(New DesignerRegion(Me, "Header1")) ' Create an editable region and add it to the regions Dim editableRegion As EditableDesignerRegion = _ New EditableDesignerRegion(Me, _ "Content" & myControl.CurrentView, False) regions.Add(editableRegion) ' Set the highlight for the selected region regions(myControl.CurrentView).Highlight = True ' Use the base class to render the markup Return MyBase.GetDesignTimeHtml() End Function
// Create the regions and design-time markup. Called by the designer host. public override String GetDesignTimeHtml(DesignerRegionCollection regions) { // Create 3 regions: 2 clickable headers and an editable row regions.Add(new DesignerRegion(this, "Header0")); regions.Add(new DesignerRegion(this, "Header1")); // Create an editable region and add it to the regions EditableDesignerRegion editableRegion = new EditableDesignerRegion(this, "Content" + myControl.CurrentView, false); regions.Add(editableRegion); // Set the highlight for the selected region regions[myControl.CurrentView].Highlight = true; // Use the base class to render the markup return base.GetDesignTimeHtml(); }


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ControlDesigner.GetDesignTimeHtml メソッド
ControlDesigner.GetDesignTimeHtml メソッド ()
アセンブリ: System.Design (system.design.dll 内)

Dim instance As ControlDesigner Dim returnValue As String returnValue = instance.GetDesignTimeHtml
デザイン時にコントロールを表すために使用する HTML マークアップ。


カスタム コントロール デザイナで GetDesignTimeHtml メソッドをオーバーライドする方法を次のコード例に示します。関連付けられているコントロールの Text プロパティが空の場合、GetDesignTimeHtml メソッドは GetEmptyDesignTimeHtml メソッドを呼び出します。それ以外の場合、GetDesignTimeHtml メソッドは Hyperlink コントロールを作成および表示します。
Public Overrides Function GetDesignTimeHtml() As String ' Component is the instance of the component or control that ' this designer object is associated with. This property is ' inherited from System.ComponentModel.ComponentDesigner. simpleControl = CType(Component, Simple) If simpleControl.Text.Length > 0 Then Dim sw As New StringWriter() Dim tw As New HtmlTextWriter(sw) Dim placeholderLink As New HyperLink() ' Put simpleControl.Text into the link's Text. placeholderLink.Text = simpleControl.Text placeholderLink.NavigateUrl = simpleControl.Text placeholderLink.RenderControl(tw) Return sw.ToString() Else Return GetEmptyDesignTimeHtml() End If End Function


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

