ערוך

שתף באמצעות


MenuItemCollectionEditor Class

Definition

Provides a component editor for the collection that is specified by the Items property of the associated Menu control.

public ref class MenuItemCollectionEditor : System::Drawing::Design::UITypeEditor
public class MenuItemCollectionEditor : System.Drawing.Design.UITypeEditor
type MenuItemCollectionEditor = class
    inherit UITypeEditor
Public Class MenuItemCollectionEditor
Inherits UITypeEditor
Inheritance
MenuItemCollectionEditor

Examples

The following code example shows how to use the EditorAttribute attribute to associate the MenuItemCollectionEditor and UITypeEditor (the collection editor base class) classes with a property in a custom control, derived from the WebControl class, that gets and sets a MenuItemCollection collection.

private MenuItemCollection menuItems;

// Associate the MenuItemCollectionEditor with the Items. 
[Editor(typeof(System.Web.UI.Design.WebControls.
    MenuItemCollectionEditor),
    typeof(UITypeEditor))]
public MenuItemCollection Items
{
    get
    {
        // If there is no menuItems collection, create it.
        if (menuItems == null)
            menuItems = new MenuItemCollection();

        return menuItems;
    }
    set { menuItems = value; }
} // Items
Private menuItems As MenuItemCollection

' Associate the MenuItemCollectionEditor with the Items.
<EditorAttribute( GetType(System.Web.UI.Design.WebControls. _
    MenuItemCollectionEditor), _
    GetType(UITypeEditor))> _
Public Property Items() As MenuItemCollection
    Get
        If menuItems Is Nothing Then
            menuItems = New MenuItemCollection()
        End If
        Return menuItems
    End Get
    Set
        menuItems = value
    End Set
End Property ' Items

Remarks

The MenuItemCollectionEditor class provides a user interface for editing the MenuItem elements of the collection that is specified by the Items property within the associated Menu control.

The MenuItemCollectionEditor is invoked by selecting the ellipsis () button on the Items property in the Properties grid of the visual designer, or by choosing Edit Menu Items from the Common Tasks context menu on the control.

The EditValue method edits the values of the menu item collection of the associated Menu control. The GetEditStyle method gets the editing style that is associated with this editor.

Constructors

MenuItemCollectionEditor()

Initializes a new instance of the MenuItemCollectionEditor class.

Properties

IsDropDownResizable

Gets a value indicating whether drop-down editors should be resizable by the user.

(Inherited from UITypeEditor)

Methods

EditValue(IServiceProvider, Object)

Edits the value of the specified object using the editor style indicated by the GetEditStyle() method.

(Inherited from UITypeEditor)
EditValue(ITypeDescriptorContext, IServiceProvider, Object)

Edits the value of the menu item collection of the associated control.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEditStyle()

Gets the editor style used by the EditValue(IServiceProvider, Object) method.

(Inherited from UITypeEditor)
GetEditStyle(ITypeDescriptorContext)

Gets the editing style that is associated with this editor.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetPaintValueSupported()

Indicates whether this editor supports painting a representation of an object's value.

(Inherited from UITypeEditor)
GetPaintValueSupported(ITypeDescriptorContext)

Indicates whether the specified context supports painting a representation of an object's value within the specified context.

(Inherited from UITypeEditor)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PaintValue(Object, Graphics, Rectangle)

Paints a representation of the value of the specified object to the specified canvas.

(Inherited from UITypeEditor)
PaintValue(PaintValueEventArgs)

Paints a representation of the value of an object using the specified PaintValueEventArgs.

(Inherited from UITypeEditor)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also