Panel Web サーバー コントロールに対してデザイン時の動作を拡張します。
この型のすべてのメンバの一覧については、PanelDesigner メンバ を参照してください。
System.Object
System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.ReadWriteControlDesigner
System.Web.UI.Design.WebControls.PanelDesigner
Public Class PanelDesigner
Inherits ReadWriteControlDesigner
[C#]
public class PanelDesigner : ReadWriteControlDesigner
[C++]
public __gc class PanelDesigner : public ReadWriteControlDesigner
[JScript]
public class PanelDesigner extends ReadWriteControlDesigner
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
使用例
[Visual Basic] PanelDesigner クラスから派生した CustomPanelDesigner
カスタム クラスのコード例を次に示します。このデザイナ クラスは、 MapPropertyToStyle メソッドと OnBehaviorAttached メソッドをオーバーライドします。このデザイナは Panel クラスから継承した CustomPanel
カスタム コントロールと共に使用します。 CustomPanel
クラスに結び付けると、このデザイナは Panel クラスの Wrap プロパティを HTML の NoWrap 属性に変換します。
[Visual Basic] メモ PanelDesigner クラスは、 ReadWriteControlDesigner クラスから直接派生したものです。したがって、 ReadWriteControlDesigner を直接オーバーライドすることによっても、 Panel.Wrap プロパティの同様の変換をデザイナに実装することはできます。ただし、この方法を使用すると、 PanelDesigner クラスによって提供される MapPropertyToStyle メソッドの基本処理は実行されなくなります。
' Create a class that derives from the PanelDesigner
' class. Because PanelDesigner derives directly
' from ReadWriteControlDesigner, you could derive
' from the latter to accomplish the same design-
' time functionality found in this example.
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Drawing.Design
Imports Microsoft.Win32
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design
Imports System.Web.UI.Design.WebControls
Namespace AspNet.Samples.Design
' The CustomPanelDesigner class is designed to be
' attached to a class that inherits the System.Web.UI.
' Panel class.
Public Class CustomPanelDesigner
Inherits PanelDesigner
' Override the MapPropertyToStyle method to set the
' Panel.Wrap property to the NoWrap HTML attribute.
Overrides Protected Sub MapPropertyToStyle(propName As String, varPropValue As Object)
' Display messages when debugging.
Debug.Assert(Not (propName = Nothing Or propName.Length <> 0), "Invalid property name passed in.")
Debug.Assert(Not (varPropValue = Nothing), "Invalid property value passed in.")
' If the parameters passed to the method are null,
' return nothing.
If ((propName Is Nothing) And (varPropValue Is Nothing)) Then
Return
End If
' If the second parameter is not a null
' value, check whether the property name is Wrap.
If Not (varPropValue Is Nothing) Then
Try
' If property name is wrap, convert
' it to the HTML NoWrap attribute.
If (propName.Equals("Wrap")) Then
Dim strValue As String = String.Empty
If (CType(varPropValue, Boolean)) Then
Behavior.SetStyleAttribute("NoWrap", True, strValue, True)
End If
Else
MyBase.MapPropertyToStyle(propName, varPropValue)
End If
Catch ex As Exception
Debug.Fail(ex.ToString())
End Try
End If
End Sub 'MapPropertyToStyle
' Override the OnBehaviorAttached method to call
' the MapPropertyToStyle method when the designer
' control's wrap property is set to true.
Overrides Protected Sub OnBehaviorAttached()
MyBase.OnBehaviorAttached()
Dim component As IComponent
Dim panel As CustomPanel = CType(component, CustomPanel)
Dim wrap As Boolean = panel.Wrap
If wrap Then
MapPropertyToStyle("Wrap", wrap)
End If
End Sub 'OnBehaviorAttached
End Class
End Namespace
[Visual Basic] 前に示した CustomPanelDesigner クラスに関連付けられている、CustomPanel という名前のカスタム Panel クラスのコード例を次に示します。
' Create the class that uses the
' CustomPanelDesigner class to be
' displayed at design time.
<Designer(GetType( _
AspNet.Samples.Design.CustomPanelDesigner))> _
Public Class CustomPanel
Inherits System.Web.UI.WebControls.Panel
Overrides Public Property Wrap As Boolean
Get
Return MyBase.Wrap
End Get
Set
MyBase.Wrap = value
End Set
End Property
End Class
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Web.UI.Design.WebControls
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: System.Design (System.Design.dll 内)
参照
PanelDesigner メンバ | System.Web.UI.Design.WebControls 名前空間 | Panel