AccessDataSourceDesigner クラス
アセンブリ: System.Design (system.design.dll 内)


ビジュアルなデザイナでソース ビューからデザイン ビューに切り替えると、AccessDataSource コントロールを記述するマークアップのソース コードが解析され、コントロールのデザイン時バージョンがデザイン サーフェイスに作成されます。デザイン時のコントロールは、単にプレースホルダとして表示されます。元のソース ビューに切り替えると、[プロパティ] グリッド内のプロパティの値を保持しているデザイン時のコントロールがマークアップ ソース コードに保持され、Web ページのマークアップに反映されます。

このセクションには、2 つのコード例が用意されています。最初のコード例は、AccessDataSourceDesigner クラスを拡張する方法を示しています。2 番目の例は、AccessDataSource クラスのコピーを派生してデザイナに関連付ける方法を示しています。
AccessDataSourceDesigner クラスを拡張する方法を次のコード例に示します。このコードでは、デザイン サーフェイス上のコントロールを表すプレースホルダを変更し、プロパティを [プロパティ] グリッドに追加しています。
' Shadow control properties with design time properties. Protected Overrides Sub PreFilterProperties(ByVal properties As IDictionary) ' Call the base class method first. MyBase.PreFilterProperties(properties) ' Add the ConnectionString property to the property grid. Dim prop As PropertyDescriptor prop = CType(properties("ConnectionString"), PropertyDescriptor) Dim atts(1) As Attribute atts(0) = New BrowsableAttribute(True) atts(1) = New ReadOnlyAttribute(True) properties("ConnectionString") = TypeDescriptor.CreateProperty( _ prop.GetType(), prop, atts) End Sub
// Shadow control properties with design time properties. protected override void PreFilterProperties(IDictionary properties) { // Call the base class method first. base.PreFilterProperties(properties); // Add the ConnectionString property to the property grid. PropertyDescriptor property = (PropertyDescriptor)properties["ConnectionString"]; Attribute[] attributes = new Attribute[] { new BrowsableAttribute(true), new ReadOnlyAttribute(true) }; properties["ConnectionString"] = TypeDescriptor.CreateProperty( GetType(), property, attributes); }
AccessDataSource クラスのコピーを派生して、上記の例で定義したデザイナに関連付ける方法を次のコード例に示します。
' Create a control and bind it to the ExampleAccessDataSourceDesigner. <AspNetHostingPermission(System.Security.Permissions.SecurityAction.Demand, _ Level:=System.Web.AspNetHostingPermissionLevel.Minimal)> _ <AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, _ Level:=System.Web.AspNetHostingPermissionLevel.Minimal)> _ <Designer("CustomControls.Design.ExampleAccessDataSourceDesigner")> _ Public Class ExampleAccessDataSource Inherits AccessDataSource ' Does nothing extra End Class
// Create a control and bind it to the ExampleAccessDataSourceDesigner. [AspNetHostingPermission(System.Security.Permissions.SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand , Level = AspNetHostingPermissionLevel.Minimal)] [Designer(typeof(CustomControls.Design.ExampleAccessDataSourceDesigner))] public class ExampleAccessDataSource : AccessDataSource { // Does nothing extra }

- SecurityPermission (アンマネージ コードを呼び出すために必要なアクセス許可)。要求値 : Demand。アクセス許可値 : UnmanagedCode。

System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.DataSourceDesigner
System.Web.UI.Design.WebControls.SqlDataSourceDesigner
System.Web.UI.Design.WebControls.AccessDataSourceDesigner


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- AccessDataSourceDesigner クラスのページへのリンク