CollectionEditor 類別

定義

提供可在設計階段編輯大部分集合型別的使用者介面。Provides a user interface that can edit most types of collections at design time.

public ref class CollectionEditor : System::Drawing::Design::UITypeEditor
public class CollectionEditor : System.Drawing.Design.UITypeEditor
type CollectionEditor = class
    inherit UITypeEditor
Public Class CollectionEditor
Inherits UITypeEditor
繼承
CollectionEditor
衍生

範例

下列程式碼範例會使用 EditorAttribute,將 CollectionEditor 與屬性產生關聯。The following code example uses an EditorAttribute to associate the CollectionEditor with a property.

public:
   [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid,
      System::Drawing::Design::UITypeEditor::typeid)]
   property ICollection^ testCollection 
   {
      ICollection^ get()
      {
         return Icollection;
      }
      void set( ICollection^ value )
      {
         Icollection = value;
      }
   }
private:
   ICollection^ Icollection;
[EditorAttribute(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
public ICollection testCollection
{
    get
    {
        return Icollection;
    }
    set
    {
        Icollection = value;
    }
}
private ICollection Icollection;
<EditorAttribute(GetType(System.ComponentModel.Design.CollectionEditor), GetType(System.Drawing.Design.UITypeEditor))>  _
Public Property testCollection() As ICollection
   Get
      Return Icollection
   End Get
   Set
      Icollection = value
   End Set
End Property
Private Icollection As ICollection

給繼承者的注意事項

此編輯器可以編輯具有 Item 屬性的集合。This editor can edit collections that have an Item property. 編輯器可以從 Item 屬性判斷集合的類型(如果存在的話)。The editor can determine the type of the collection from the Item property, if it exists. 如果集合沒有這個屬性,或者您想要提供多個類型的集合,您可以覆寫這個類別的某些受保護成員,以自訂編輯器以支援其他類型的集合。If the collection does not have this property, or if you want to provide collections of more than one type, you can override certain protected members of this class to customize the editor to support other types of collections.

建構函式

CollectionEditor(Type)

使用指定的集合型別,初始化 CollectionEditor 類別的新執行個體。Initializes a new instance of the CollectionEditor class using the specified collection type.

屬性

CollectionItemType

取得集合中每個項目的資料型別。Gets the data type of each item in the collection.

CollectionType

取得集合物件 (Collection Object) 的資料型別。Gets the data type of the collection object.

Context

取得指示目前內容的型別描述項。Gets a type descriptor that indicates the current context.

HelpTopic

當按下編輯器的對話方塊 [說明] 按鈕或 F1 鍵時,取得 Help 關鍵字以顯示說明主題或主題清單。Gets the Help keyword to display the Help topic or topic list for when the editor's dialog box Help button or the F1 key is pressed.

IsDropDownResizable

取得值,表示使用者是否能夠調整下拉式編輯器的大小。Gets a value indicating whether drop-down editors should be resizable by the user.

(繼承來源 UITypeEditor)
NewItemTypes

取得可為這個集合建立的項目之可用型別。Gets the available types of items that can be created for this collection.

方法

CancelChanges()

取消對集合所做的變更。Cancels changes to the collection.

CanRemoveInstance(Object)

指示集合的原始成員是否可移除。Indicates whether original members of the collection can be removed.

CanSelectMultipleInstances()

指示是否可以一次選取多個集合項目。Indicates whether multiple collection items can be selected at once.

CreateCollectionForm()

建立要顯示和編輯目前集合的新表單。Creates a new form to display and edit the current collection.

CreateCollectionItemType()

取得這個集合所包含的資料型別。Gets the data type that this collection contains.

CreateInstance(Type)

建立指定集合項目型別的新執行個體。Creates a new instance of the specified collection item type.

CreateNewItemTypes()

取得這個集合編輯器可包含的資料型別。Gets the data types that this collection editor can contain.

DestroyInstance(Object)

終結物件的指定執行個體。Destroys the specified instance of the object.

EditValue(IServiceProvider, Object)

使用由 GetEditStyle() 方法指示的編輯器樣式,來編輯指定物件的值。Edits the value of the specified object using the editor style indicated by the GetEditStyle() method.

(繼承來源 UITypeEditor)
EditValue(ITypeDescriptorContext, IServiceProvider, Object)

使用指定服務提供者和內容,編輯指定物件的值。Edits the value of the specified object using the specified service provider and context.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetDisplayText(Object)

取出指定清單項目的顯示文字。Retrieves the display text for the given list item.

GetEditStyle()

取得 EditValue(IServiceProvider, Object) 方法所使用的編輯器樣式。Gets the editor style used by the EditValue(IServiceProvider, Object) method.

(繼承來源 UITypeEditor)
GetEditStyle(ITypeDescriptorContext)

取得 EditValue(ITypeDescriptorContext, IServiceProvider, Object) 方法所使用的編輯樣式。Gets the edit style used by the EditValue(ITypeDescriptorContext, IServiceProvider, Object) method.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetItems(Object)

取得包含指定集合的物件陣列。Gets an array of objects containing the specified collection.

GetObjectsFromInstance(Object)

傳回含有指定物件的清單。Returns a list containing the given object.

GetPaintValueSupported()

指出這個編輯器是否支援繪製物件值的表示。Indicates whether this editor supports painting a representation of an object's value.

(繼承來源 UITypeEditor)
GetPaintValueSupported(ITypeDescriptorContext)

指出指定的內容是否支援在指定的內容中繪製物件值的表示。Indicates whether the specified context supports painting a representation of an object's value within the specified context.

(繼承來源 UITypeEditor)
GetService(Type)

如果有可用的服務,則取得所要求的服務。Gets the requested service, if it is available.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
PaintValue(Object, Graphics, Rectangle)

將指定物件的表示值繪製到指定的畫布上。Paints a representation of the value of the specified object to the specified canvas.

(繼承來源 UITypeEditor)
PaintValue(PaintValueEventArgs)

使用指定的 PaintValueEventArgs 來繪製物件值的表示。Paints a representation of the value of an object using the specified PaintValueEventArgs.

(繼承來源 UITypeEditor)
SetItems(Object, Object[])

設定指定的陣列為集合的項目。Sets the specified array as the items of the collection.

ShowHelp()

顯示集合編輯器的預設說明主題。Displays the default Help topic for the collection editor.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於

另請參閱