AccessDataSourceDesigner 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供網頁伺服器控制的視覺化設計器 AccessDataSource 設計時支援。
public ref class AccessDataSourceDesigner : System::Web::UI::Design::WebControls::SqlDataSourceDesigner
public class AccessDataSourceDesigner : System.Web.UI.Design.WebControls.SqlDataSourceDesigner
type AccessDataSourceDesigner = class
inherit SqlDataSourceDesigner
Public Class AccessDataSourceDesigner
Inherits SqlDataSourceDesigner
- 繼承
-
AccessDataSourceDesigner
範例
本節提供兩個程式碼範例。 第一個示範如何擴展 AccessDataSourceDesigner 課程。 第二項示範如何衍生該類別的副本 AccessDataSource 並將其與設計師關聯。
以下程式碼範例示範如何擴充該 AccessDataSourceDesigner 類別。 程式碼會修改代表設計表面控制項的佔位符,並在 屬性 網格中新增屬性。
// 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);
}
' 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
以下程式碼範例示範如何衍生該 AccessDataSource 類別的副本,並將其與前述範例中定義的設計器關聯。
// 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
}
' 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
備註
在視覺設計器中,當你從原始碼視圖切換到設計視圖時,描述控制項的標記原始碼 AccessDataSource 會被解析,並在設計表面建立一個設計時版本,僅作為佔位符。 當你切回原始碼視圖時,設計時控制項(包含 屬性 格子中屬性的值)會持續存在於標記原始碼,並編輯到網頁的標記中。
建構函式
| 名稱 | Description |
|---|---|
| AccessDataSourceDesigner() |
初始化 AccessDataSource 類別的新執行個體。 |
屬性
方法
事件
| 名稱 | Description |
|---|---|
| DataSourceChanged |
當相關資料來源的任何屬性改變時,就會發生這種情況。 (繼承來源 DataSourceDesigner) |
| SchemaRefreshed |
發生在結構更新後。 (繼承來源 DataSourceDesigner) |
明確介面實作
| 名稱 | Description |
|---|---|
| IDesignerFilter.PostFilterAttributes(IDictionary) |
關於此成員的描述,請參見方法。PostFilterAttributes(IDictionary) (繼承來源 ComponentDesigner) |
| IDesignerFilter.PostFilterEvents(IDictionary) |
關於此成員的描述,請參見方法。PostFilterEvents(IDictionary) (繼承來源 ComponentDesigner) |
| IDesignerFilter.PostFilterProperties(IDictionary) |
關於此成員的描述,請參見方法。PostFilterProperties(IDictionary) (繼承來源 ComponentDesigner) |
| IDesignerFilter.PreFilterAttributes(IDictionary) |
關於此成員的描述,請參見方法。PreFilterAttributes(IDictionary) (繼承來源 ComponentDesigner) |
| IDesignerFilter.PreFilterEvents(IDictionary) |
關於此成員的描述,請參見方法。PreFilterEvents(IDictionary) (繼承來源 ComponentDesigner) |
| IDesignerFilter.PreFilterProperties(IDictionary) |
關於此成員的描述,請參見方法。PreFilterProperties(IDictionary) (繼承來源 ComponentDesigner) |
| ITreeDesigner.Children |
關於此成員的描述,請參見 Children 該物業。 (繼承來源 ComponentDesigner) |
| ITreeDesigner.Parent |
關於此成員的描述,請參見 Parent 該物業。 (繼承來源 ComponentDesigner) |