デザイン時にコントロールを表すために使用する HTML を取得します。
Overrides Public Function GetDesignTimeHtml() As String
[C#]
public override string GetDesignTimeHtml();
[C++]
public: String* GetDesignTimeHtml();
[JScript]
public override function GetDesignTimeHtml() : String;
戻り値
デザイン時にコントロールを表すために使用する HTML。
使用例
[Visual Basic] GetDesignTimeHtml メソッドをオーバーライドして、 WebControl.Enabled プロパティの値が true の場合に SimpleDataList
クラスの表示関連プロパティを設定および表示するコード例を次に示します。このコードでは、各プロパティへの値の設定に Try...Catch...Finally 構文を使用してします。つまり、 Try セクションで、 BorderWidth 、 BorderColor の各プロパティの値を設定し、 Catch セクションで、発生した例外をキャッチして GetErrorDesignTimeHtml メソッドに送信し、 Finally セクションで各プロパティの値を元に戻します。
[Visual Basic] 次のコード例は DataListDesigner クラスの例の一部です。
' Override the GetDesignTimeHtml method to add style
' to the control on the design surface.
Overrides Public Function GetDesignTimeHtml() As String
' Cast the control to the Component property of the designer.
simpleList = CType(Component, SimpleDataList)
Dim designTimeHtml As String = Nothing
' Create variables to hold current property settings.
Dim oldBorderWidth As Unit = simpleList.BorderWidth
Dim oldBorderColor As Color = simpleList.BorderColor
' Set properties and the design-time HTML.
If (simpleList.Enabled) Then
Try
simpleList.BorderWidth = Unit.Point(5)
simpleList.BorderColor = Color.Purple
designTimeHtml = MyBase.GetDesignTimeHtml()
' If an exception occurs, call the GetErrorDesignTimeHtml
' method.
Catch ex As Exception
designTimeHtml = GetErrorDesignTimeHtml(ex)
' Return properties to their original settings.
Finally
simpleList.BorderWidth = oldBorderWidth
simpleList.BorderColor = oldBorderColor
End Try
' Call the GetEmptyDesignTimeHtml method if
' the condition is not met.
Else
designTimeHtml = GetEmptyDesignTimeHtml()
End If
Return designTimeHtml
End Function
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
DataListDesigner クラス | DataListDesigner メンバ | System.Web.UI.Design.WebControls 名前空間