語言

DataGridDesigner 類別

定義

擴充了網頁伺服器控制的設計時行為 DataGrid 。

public ref class DataGridDesigner : System::Web::UI::Design::WebControls::BaseDataListDesigner
public class DataGridDesigner : System.Web.UI.Design.WebControls.BaseDataListDesigner
[System.Web.UI.Design.SupportsPreviewControl(true)]
public class DataGridDesigner : System.Web.UI.Design.WebControls.BaseDataListDesigner
type DataGridDesigner = class
    inherit BaseDataListDesigner
[<System.Web.UI.Design.SupportsPreviewControl(true)>]
type DataGridDesigner = class
    inherit BaseDataListDesigner
Public Class DataGridDesigner
Inherits BaseDataListDesigner
繼承
屬性

範例

以下程式碼範例示範如何擴充該 DataGridDesigner 類別。 當GetDesignTimeHtml控制項在設計曲面上渲染時,程式碼會CellPaddingBorderWidth覆寫自訂 、 BorderColor、 及DataGrid屬性的方法。

Imports System.Diagnostics
Imports System.ComponentModel
Imports System.Drawing
Imports System.Web.UI.Design.WebControls
Imports System.Web.UI.WebControls

Namespace Examples.AspNet

    ' Create a designer class for the SimpleDataList class.
    <System.Security.Permissions.SecurityPermission( _
    System.Security.Permissions.SecurityAction.Demand, _
    Flags:=System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)> _
    Public Class SimpleDataListDesigner
        Inherits DataListDesigner

        Private simpleList As SimpleDataList


        ' Override the GetDesignTimeHtml method to add style to the control
        ' on the design surface.
        Public Overrides 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 values.
            Dim oldBorderWidth As Unit = simpleList.BorderWidth
            Dim oldBorderColor As Color = simpleList.BorderColor

            ' Set the properties and generate the design-time HTML.
            If (simpleList.Enabled) Then
                Try
                    simpleList.BorderWidth = Unit.Point(5)
                    simpleList.BorderColor = Color.Purple
                    designTimeHtml = MyBase.GetDesignTimeHtml()

                    ' Call the GetErrorDesignTimeHtml method if an
                    ' exception occurs.
                Catch ex As Exception
                    designTimeHtml = GetErrorDesignTimeHtml(ex)

                    ' Return the properties to their original settings.
                Finally
                    simpleList.BorderWidth = oldBorderWidth
                    simpleList.BorderColor = oldBorderColor
                End Try
                ' If the list is not enabled, call the GetEmptyDesignTimeHtml
                ' method.
            Else
                designTimeHtml = GetEmptyDesignTimeHtml()
            End If

            Return designTimeHtml

        End Function

        Protected Overrides Function GetEmptyDesignTimeHtml() As String
            Dim emptyText As String

            ' Check the CanEnterTemplateMode property to
            ' specify which text to display if ItemTemplate 
            ' does not contain a value.
            If CanEnterTemplateMode Then
                emptyText = _
                    "<b>Either the Enabled property value is false " + _
                    "or you need to set the ItemTemplate for this " + _
                    "control.<br>Right-click to edit templates.</b>"
            Else
                emptyText = _
                    "<b>You cannot edit templates in this view.<br>" + _
                    "Switch to HTML view to define the ItemTemplate.</b>"
            End If

            Return CreatePlaceHolderDesignTimeHtml(emptyText)
        End Function

        ' Generate HTML to indicate that an error has occurred.
        Protected Overrides Function GetErrorDesignTimeHtml(ByVal exc As _
            Exception) As String

            Return CreatePlaceHolderDesignTimeHtml( _
                "<b>An error occurred</b>.<br>Check to ensure that all " + _
                "properties are valid.")
        End Function


        ' Override the Initialize method to ensure that
        ' only an instance of the SimpleDataList class is
        ' used by this designer class.
        Public Overrides Sub Initialize(ByVal component As IComponent)
            simpleList = CType(component, SimpleDataList)

            If IsNothing(simpleList) Then
                Throw New ArgumentException("Must be a SimpleDataList.", "component")
            End If

            MyBase.Initialize(component)
        End Sub
    End Class
End Namespace

以下範例說明如何利用 DesignerAttribute 屬性將設計者與 DataGrid 控制項關聯起來。

' Override the Initialize method to ensure that
' only an instance of the SimpleDataList class is
' used by this designer class.
Public Overrides Sub Initialize(ByVal component As IComponent)
    simpleList = CType(component, SimpleDataList)

    If IsNothing(simpleList) Then
        Throw New ArgumentException("Must be a SimpleDataList.", "component")
    End If

    MyBase.Initialize(component)
End Sub

建構函式

名稱 Description
DataGridDesigner()

初始化 DataGridDesigner 類別的新執行個體。

屬性

名稱 Description
ActionLists

為此設計師取得設計師行動清單系列。

(繼承來源 BaseDataListDesigner)
ActiveTemplateEditingFrame
已淘汰.

取得活躍的模板編輯框架。

(繼承來源 TemplatedControlDesigner)
AllowResize

會獲得一個值,表示控制項是否能在設計時環境中調整大小。

(繼承來源 ControlDesigner)
AssociatedComponents

取得設計師管理的與該元件相關的元件集合。

(繼承來源 ComponentDesigner)
AutoFormats

取得 DesignerAutoFormatCollection 與此設計者相關的物件。

Behavior
已淘汰.

取得或設定與設計器相關的 DHTML 行為。

(繼承來源 HtmlControlDesigner)
CanEnterTemplateMode

會有一個值,表示該設計師是否允許查看或編輯範本。

(繼承來源 TemplatedControlDesigner)
Component

取得設計師正在設計的元件。

(繼承來源 ComponentDesigner)
DataBindings

取得目前控制項的資料綁定收集。

(繼承來源 HtmlControlDesigner)
DataBindingsEnabled

會得到一個值,表示設計者是否允許資料綁定。

(繼承來源 TemplatedControlDesigner)
DataKeyField

取得或設定相關控制項資料鍵欄位的值。

(繼承來源 BaseDataListDesigner)
DataMember

取得或設定相關控制項資料成員欄位的值。

(繼承來源 BaseDataListDesigner)
DataSource

取得或設定相關控制項資料來源屬性的值。

(繼承來源 BaseDataListDesigner)
DataSourceDesigner

當選擇資料綁定時,取得資料來源的設計者。

(繼承來源 BaseDataListDesigner)
DataSourceID

取得或設定設計者版本的資料來源 ID 屬性,並用來追蹤相關控制項的相應屬性。

(繼承來源 BaseDataListDesigner)
DesignerState

取得一個物件,用於在設計時持久化相關控制項的資料。

(繼承來源 ControlDesigner)
DesignerView

取得綁定到相關控制項的資料來源預設視圖。

(繼承來源 BaseDataListDesigner)
DesignTimeElement
已淘汰.

取得代表該物件在設計表面上所關聯 HtmlControlDesigner 控制項的設計時物件。

(繼承來源 HtmlControlDesigner)
DesignTimeElementView
已淘汰.

取得控制設計器的視控物件。

(繼承來源 ControlDesigner)
DesignTimeHtmlRequiresLoadComplete

會取得一個值,指示是否必須完成載入才能顯示設計時標記。

(繼承來源 BaseDataListDesigner)
Expressions

在設計時取得目前控制項的表達式綁定。

(繼承來源 HtmlControlDesigner)
HidePropertiesInTemplateMode

會取得一個值,表示當控制項進入範本編輯模式時,控制項的屬性是否會被隱藏。

(繼承來源 TemplatedControlDesigner)
ID

取得或設定控制項的 ID 字串。

(繼承來源 ControlDesigner)
InheritanceAttribute

會獲得一個屬性,表示相關元件繼承的類型。

(繼承來源 ComponentDesigner)
Inherited

會得到一個值,表示該元件是否為繼承。

(繼承來源 ComponentDesigner)
InTemplateMode
已淘汰.

會取得一個值,表示設計器文件是否處於範本模式。

(繼承來源 TemplatedControlDesigner)
IsDirty
已淘汰.

取得或設定一個值,表示網頁伺服器控制項是否被標記為變更。

(繼承來源 ControlDesigner)
ParentComponent

取得這個設計器的父元件。

(繼承來源 ComponentDesigner)
ReadOnly
已淘汰.

取得或設定一個值,表示控制項屬性在設計時是否為唯讀。

(繼承來源 ControlDesigner)
RootDesigner

取得包含相關控制項的網頁表單頁面的控制項設計器。

(繼承來源 ControlDesigner)
ShadowProperties

會取得一組屬性值,覆蓋使用者設定。

(繼承來源 ComponentDesigner)
ShouldCodeSerialize
已淘汰.

在序列化過程中,會取得或設定一個值,指示是否要在目前設計文件的程式碼背後檔案中為控制項建立欄位宣告。

(繼承來源 HtmlControlDesigner)
Tag

取得一個代表相關控制項 HTML 標記元素的物件。

(繼承來源 ControlDesigner)
TemplateGroups

會得到一組模板群組,每個群組都包含一個範本定義。

(繼承來源 TemplatedControlDesigner)
UsePreviewControl

會取得一個值,指示控制項設計者是否使用暫存預覽控制來產生設計時的 HTML 標記。

(繼承來源 ControlDesigner)
Verbs

取得這個設計師可用的動詞集合。

(繼承來源 BaseDataListDesigner)
ViewControl

取得或設定一個網頁伺服器控制項,可用於預覽設計時的 HTML 標記。

(繼承來源 ControlDesigner)
ViewControlCreated

取得或設定一個值,指示是否 View 已建立控制項以顯示於設計表面。

(繼承來源 ControlDesigner)
Visible

會獲得一個值,表示該控制點在設計時是否可見。

(繼承來源 ControlDesigner)

方法

名稱 Description
CreateErrorDesignTimeHtml(String, Exception)

建立 HTML 標記,在設計時顯示指定的例外錯誤訊息。

(繼承來源 ControlDesigner)
CreateErrorDesignTimeHtml(String)

建立 HTML 標記,在設計時顯示指定的錯誤訊息。

(繼承來源 ControlDesigner)
CreatePlaceHolderDesignTimeHtml()

提供簡單的矩形佔位符號表示,顯示控制項的類型與 ID。

(繼承來源 ControlDesigner)
CreatePlaceHolderDesignTimeHtml(String)

提供簡單的矩形佔位符號表示,顯示控制項的類型與 ID,以及額外指定的指令或資訊。

(繼承來源 ControlDesigner)
CreateTemplateEditingFrame(TemplateEditingVerb)
已淘汰.

使用指定的動詞建立範本編輯框架。

CreateViewControl()

回傳相關控制項的副本,用於在設計表面上檢視或渲染。

(繼承來源 ControlDesigner)
Dispose()

釋放 ComponentDesigner所使用的所有資源。

(繼承來源 ComponentDesigner)
Dispose(Boolean)

釋放物件所使用的 DataGridDesigner 非管理資源,並可選擇性地釋放受管理資源。

DoDefaultAction()

在原始碼檔案中為元件的預設事件建立方法簽章,並引導使用者游標到該位置。

(繼承來源 ComponentDesigner)
EnterTemplateMode(ITemplateEditingFrame)
已淘汰.

在設計器中開啟特定的模板框架物件以便編輯。

(繼承來源 TemplatedControlDesigner)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
ExitTemplateMode(Boolean, Boolean, Boolean)
已淘汰.

儲存所有相關變更後,關閉目前啟用的模板編輯框。

(繼承來源 TemplatedControlDesigner)
GetBounds()

取得代表控制點邊界的矩形座標,該矩形在設計表面上顯示。

(繼承來源 ControlDesigner)
GetCachedTemplateEditingVerbs()
已淘汰.

取得設計者可用的快取範本編輯動詞。

GetDesignTimeDataSource(IEnumerable, Int32, Boolean)

產生一個可在設計時作為資料來源的物件。

(繼承來源 BaseDataListDesigner)
GetDesignTimeDataSource(Int32, Boolean)

產生一個可在設計時作為資料來源的物件。

(繼承來源 BaseDataListDesigner)
GetDesignTimeHtml()

取得設計時用來表示 DataGrid 控制項的 HTML 標記。

GetDesignTimeHtml(DesignerRegionCollection)

取得 HTML 標記以顯示控制項,並將目前控制項設計區域填充集合。

(繼承來源 ControlDesigner)
GetEditableDesignerRegionContent(EditableDesignerRegion)

回傳可編輯區域中可編輯的相關控制項。

(繼承來源 ControlDesigner)
GetEmptyDesignTimeHtml()

取得設計時用來表示空白模板控制項的 HTML 標記。

GetErrorDesignTimeHtml(Exception)

當渲染控制項時遇到錯誤時,會顯示指定例外的 HTML 標記。

GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetPersistenceContent()

在設計時擷取控制項的持久性內部 HTML 標記。

(繼承來源 ControlDesigner)
GetPersistInnerHtml()

它會讓標記持續存在於相關伺服器控制執行時的內容。

(繼承來源 TemplatedControlDesigner)
GetResolvedSelectedDataSource()

從相關的控制容器取得資料來源元件,並解析為特定資料成員。

(繼承來源 BaseDataListDesigner)
GetSelectedDataSource()

從相關的控制容器取得資料來源元件。

(繼承來源 BaseDataListDesigner)
GetService(Type)

嘗試從設計者元件的設計模式網站擷取指定類型的服務。

(繼承來源 ComponentDesigner)
GetTemplateContainerDataItemProperty(String)
已淘汰.

取得範本容器的資料項目屬性。

GetTemplateContainerDataSource(String)
已淘汰.

取得範本容器的資料來源。

(繼承來源 BaseDataListDesigner)
GetTemplateContent(ITemplateEditingFrame, String, Boolean)
已淘汰.

取得範本內容。

GetTemplateEditingVerbs()
已淘汰.

提供範本編輯動詞供設計者使用。

(繼承來源 TemplatedControlDesigner)
GetTemplateFromText(String)

從指定的文字建立範本。

(繼承來源 TemplatedControlDesigner)
GetTemplatePropertyParentType(String)
已淘汰.

取得 Type 對應於指定範本父節點的物件。

GetTextFromTemplate(ITemplate)

會取得一串代表指定範本的文字串。

(繼承來源 TemplatedControlDesigner)
GetType()

取得目前實例的 Type。

(繼承來源 Object)
GetViewRendering()

擷取包含相關控制項內容及區域設計時標記的物件。

(繼承來源 ControlDesigner)
Initialize(IComponent)

初始化設計者並使用指定的 DataGrid 控制項。

InitializeExistingComponent(IDictionary)

重新初始化現有元件。

(繼承來源 ComponentDesigner)
InitializeNewComponent(IDictionary)

初始化新建立的元件。

(繼承來源 ComponentDesigner)
InitializeNonDefault()
已淘汰.
已淘汰.

初始化已初始化為非預設設定的匯入元件的設定。

(繼承來源 ComponentDesigner)
Invalidate()

會使設計表面上顯示的整個控制區域失效,並指示控制設計師重新繪製控制控制。

(繼承來源 ControlDesigner)
Invalidate(Rectangle)

使顯示在設計表面上的控制區域失效,並指示控制設計師重新繪製控制控制。

(繼承來源 ControlDesigner)
InvokeGetInheritanceAttribute(ComponentDesigner)

得到 InheritanceAttribute 指定的 ComponentDesigner。

(繼承來源 ComponentDesigner)
InvokePropertyBuilder(Int32)

呼叫相關控制項的元件編輯器。

(繼承來源 BaseDataListDesigner)
IsPropertyBound(String)
已淘汰.

擷取一個值,指示相關控制項上的指定屬性是否為資料綁定。

(繼承來源 ControlDesigner)
Localize(IDesignTimeResourceWriter)

利用提供的資源寫入器,將相關控制項的可區域化屬性持久化至設計主機中的資源。

(繼承來源 ControlDesigner)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
OnAutoFormat(Object, EventArgs)
已淘汰.

負責這個 AutoFormat 活動。

(繼承來源 BaseDataListDesigner)
OnAutoFormatApplied(DesignerAutoFormat)

當對相關控制項套用自動格式化方案時,會呼叫此訊息。

(繼承來源 BaseDataListDesigner)
OnBehaviorAttached()
已淘汰.

當行為附加於設計者時,提供執行額外處理的機會。

(繼承來源 TemplatedControlDesigner)
OnBehaviorDetaching()
已淘汰.

當行為與元素分離時被召喚。

(繼承來源 HtmlControlDesigner)
OnBindingsCollectionChanged(String)
已淘汰.

當資料綁定集合變更時會被呼叫。

(繼承來源 ControlDesigner)
OnClick(DesignerRegionMouseEventArgs)

當使用者在設計時點擊相關控制項時,設計主機會呼叫此功能。

(繼承來源 ControlDesigner)
OnColumnsChanged()

當範本欄位變更時呼叫。

OnComponentChanged(Object, ComponentChangedEventArgs)

當相關控制發生變更時會被呼叫。

(繼承來源 BaseDataListDesigner)
OnComponentChanging(Object, ComponentChangingEventArgs)

代表將 ComponentChanging 處理相關控制項事件的方法。

(繼承來源 ControlDesigner)
OnControlResize()
已淘汰.

當設計主機在設計時調整了相關的網頁伺服器控制項時,會呼叫。

(繼承來源 ControlDesigner)
OnDataSourceChanged()

當相關控制的資料來源變更時,會被呼叫。

(繼承來源 BaseDataListDesigner)
OnPaint(PaintEventArgs)

當控制設計者在設計表面繪製相關控制項時,若值 CustomPaint 為 true,則呼叫 。

(繼承來源 ControlDesigner)
OnPropertyBuilder(Object, EventArgs)

代表處理物業建商事件的方法。

(繼承來源 BaseDataListDesigner)
OnSchemaRefreshed()

當相關控制的資料來源結構變更時,會被呼叫。

(繼承來源 BaseDataListDesigner)
OnSetComponentDefaults()
已淘汰.
已淘汰.

設定元件的預設屬性。

(繼承來源 ComponentDesigner)
OnSetParent()

當該設計器的父程式變更時,提供執行額外處理的機會。

(繼承來源 TemplatedControlDesigner)
OnStylesChanged()

可以覆寫,以實作當相關控制項風格改變時應有的功能。

(繼承來源 BaseDataListDesigner)
OnTemplateEditingVerbsChanged()

當模板編輯動詞改變時會被呼叫。

OnTemplateModeChanged()

當範本模式改變時,提供執行額外處理的機會。

(繼承來源 TemplatedControlDesigner)
PostFilterAttributes(IDictionary)

允許設計者更改或移除其透過 TypeDescriptor.

(繼承來源 ComponentDesigner)
PostFilterEvents(IDictionary)

允許設計者更改或移除透過 TypeDescriptor.

(繼承來源 ComponentDesigner)
PostFilterProperties(IDictionary)

允許設計者更改或移除透過 TypeDescriptor.

(繼承來源 ComponentDesigner)
PreFilterAttributes(IDictionary)

允許設計者透過 . 來擴充其所暴露 TypeDescriptor的屬性集合。

(繼承來源 ComponentDesigner)
PreFilterEvents(IDictionary)

設定元件物件在設計時 TypeDescriptor 會被暴露的事件清單。

(繼承來源 HtmlControlDesigner)
PreFilterProperties(IDictionary)

設計者用來移除或新增屬性到 屬性格子 中的顯示,或遮蔽相關控制項的屬性。

(繼承來源 BaseDataListDesigner)
RaiseComponentChanged(MemberDescriptor, Object, Object)

通知該 IComponentChangeService 元件已被更改。

(繼承來源 ComponentDesigner)
RaiseComponentChanging(MemberDescriptor)

通知該 IComponentChangeService 元件即將被更改。

(繼承來源 ComponentDesigner)
RaiseResizeEvent()
已淘汰.

引發 OnControlResize() 事件。

(繼承來源 ControlDesigner)
RegisterClone(Object, Object)

將內部資料登錄在克隆控制中。

(繼承來源 ControlDesigner)
SaveActiveTemplateEditingFrame()

儲存了正在進行的模板編輯框架。

(繼承來源 TemplatedControlDesigner)
SetEditableDesignerRegionContent(EditableDesignerRegion, String)

指定設計時控制項可編輯區域的內容。

(繼承來源 ControlDesigner)
SetRegionContent(EditableDesignerRegion, String)

在控制項設計時視圖中指定可編輯區域的內容。

(繼承來源 ControlDesigner)
SetTemplateContent(ITemplateEditingFrame, String, String)
已淘汰.

設定指定的模板與框架內容。

SetViewFlags(ViewFlags, Boolean)

將指定的位 ViewFlags 元列舉分配給指定的旗標值。

(繼承來源 ControlDesigner)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)
UpdateDesignTimeHtml()

更新設計時的 HTML。

(繼承來源 TemplatedControlDesigner)

明確介面實作

名稱 Description
IDataBindingSchemaProvider.CanRefreshSchema

關於此成員的描述,請參見 CanRefreshSchema。

(繼承來源 BaseDataListDesigner)
IDataBindingSchemaProvider.RefreshSchema(Boolean)

關於此成員的描述,請參見 RefreshSchema(Boolean)。

(繼承來源 BaseDataListDesigner)
IDataBindingSchemaProvider.Schema

關於此成員的描述,請參見 Schema。

(繼承來源 BaseDataListDesigner)
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)

適用於

另請參閱