In This Article

PopupMenu Class

Represents a popup menu.

public class PopupMenu : DisposableObject, IDisposable
Inheritance:
Object MarshalByRefObject DisposableObject Object
Implements:
IDisposable

Constructors

PopupMenu(BarManager, String)

Initializes a new instance of the PopupMenu class.

public PopupMenu(BarManager barManager, string key)
Parameter Type Description
barManager BarManager

The BarManager that is managing the popup menu.

key String

A string-based key that uniquely identifies the popup menu.

PopupMenu(String)

Initializes a new instance of the PopupMenu class.

public PopupMenu(string key)
Parameter Type Description
key String

A string-based key that uniquely identifies the popup menu.

Properties

BarManager

Gets the BarManager that is managing this object.

public BarManager BarManager { get; }

Property Value

BarManager:

The BarManager that is managing this object.

Gets the BarCommandLinkCollection containing the command links for use in the control.

public BarCommandLinkCollection CommandLinks { get; }

Property Value

BarCommandLinkCollection:

The BarCommandLinkCollection containing the command links for use in the control.

Key

Gets or sets a string-based key that uniquely identifies the popup menu.

public string Key { get; set; }

Property Value

String:

A string-based key that uniquely identifies the popup menu.

Tag

Gets or sets the object that contains user-defined data about the object.

public object Tag { get; set; }

Property Value

Object:

An Object that contains user-defined data about the control. The default is null.

Remarks

Any type derived from the Object class can be assigned to this property.

ToolBarStyledMenuWrapWidth

Gets or sets the menu wrap width, in pixels.

public int ToolBarStyledMenuWrapWidth { get; set; }

Property Value

Int32:

The menu wrap width, in pixels.

Remarks

This property value is primarily used for menus that have a toolbar style.

UseToolBarStyle

Gets or sets whether to display the popup menu using a toolbar style.

public bool UseToolBarStyle { get; set; }

Property Value

Boolean:

true if a toolbar style should be used; otherwise, false.

Methods

Dispose(Boolean)

Disposes any resources used by the object.

protected override void Dispose(bool disposing)
Parameter Type Description
disposing Boolean

Whether the object is being disposed.

OnClosed(EventArgs)

Raises the Closed event.

protected virtual void OnClosed(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

ReadAttributesFromXml(BarLayoutXmlSerializer)

Deserializes the attribute data for the PopupMenu from XML.

protected virtual void ReadAttributesFromXml(BarLayoutXmlSerializer serializer)
Parameter Type Description
serializer BarLayoutXmlSerializer

The BarLayoutXmlSerializer to use.

ReadElementFromXml(BarLayoutXmlSerializer)

Deserializes a child element for the PopupMenu from XML.

protected virtual void ReadElementFromXml(BarLayoutXmlSerializer serializer)
Parameter Type Description
serializer BarLayoutXmlSerializer

The BarLayoutXmlSerializer to use.

ResetToolBarStyledMenuWrapWidth()

Resets the ToolBarStyledMenuWrapWidth property to its default value.

public virtual void ResetToolBarStyledMenuWrapWidth()

ResetUseToolBarStyle()

Resets the UseToolBarStyle property to its default value.

public virtual void ResetUseToolBarStyle()

ShouldSerializeToolBarStyledMenuWrapWidth()

Indicates whether the ToolBarStyledMenuWrapWidth property should be persisted.

public virtual bool ShouldSerializeToolBarStyledMenuWrapWidth()

Returns

Boolean:

true if the property value has changed from its default; otherwise, false.

ShouldSerializeUseToolBarStyle()

Indicates whether the UseToolBarStyle property should be persisted.

public virtual bool ShouldSerializeUseToolBarStyle()

Returns

Boolean:

true if the property value has changed from its default; otherwise, false.

Show(Point)

Shows the popup menu at the specified screen location.

public void Show(Point point)
Parameter Type Description
point Point

A Point specifying the screen location at which to display the popup menu.

Show(Rectangle, Corner, Orientation, Int32)

Shows the popup menu around the specified screen bounds.

public void Show(Rectangle exclusionBounds, Corner exclusionCorner, Orientation orientation, int offset)
Parameter Type Description
exclusionBounds Rectangle

The screen bounds over which the object may not be displayed.

exclusionCorner Corner

The corner of the exclusion bounds at which to place the popup.

orientation Orientation

Whether the popup should extend horizontally or vertically from the corner.

offset Int32

The amount to offset from the exclusion bounds.

Show(Control, Point)

Shows the popup menu at the specified control client location.

public void Show(Control ownerControl, Point point)
Parameter Type Description
ownerControl Control

The Control upon which the popup menu should be displayed.

point Point

A Point specifying the client location at which to display the popup menu.

Show(Control, Point, Boolean)

Shows the popup menu at the specified location.

public void Show(Control ownerControl, Point point, bool isClientLocation)
Parameter Type Description
ownerControl Control

The Control upon which the popup menu should be displayed.

point Point

A Point specifying the client location at which to display the popup menu.

isClientLocation Boolean

Whether the location is relative to the specified Control.

Show(Control, Rectangle, Corner, Orientation, Int32)

Shows the popup menu around the specified client bounds.

public void Show(Control ownerControl, Rectangle exclusionBounds, Corner exclusionCorner, Orientation orientation, int offset)
Parameter Type Description
ownerControl Control

The Control upon which the popup menu should be displayed.

exclusionBounds Rectangle

The client bounds over which the object may not be displayed.

exclusionCorner Corner

The corner of the exclusion bounds at which to place the popup.

orientation Orientation

Whether the popup should extend horizontally or vertically from the corner.

offset Int32

The amount to offset from the exclusion bounds.

Show(Control, Rectangle, Corner, Orientation, Int32, Boolean)

Shows the popup menu around the specified bounds.

public void Show(Control ownerControl, Rectangle exclusionBounds, Corner exclusionCorner, Orientation orientation, int offset, bool isClientBounds)
Parameter Type Description
ownerControl Control

The Control upon which the popup menu should be displayed.

exclusionBounds Rectangle

The client bounds over which the object may not be displayed.

exclusionCorner Corner

The corner of the exclusion bounds at which to place the popup.

orientation Orientation

Whether the popup should extend horizontally or vertically from the corner.

offset Int32

The amount to offset from the exclusion bounds.

isClientBounds Boolean

Whether the bounds are relative to the specified Control.

WriteAttributesToXml(BarLayoutXmlSerializer)

Serializes the attribute data for the BarCommand to XML.

protected virtual void WriteAttributesToXml(BarLayoutXmlSerializer serializer)
Parameter Type Description
serializer BarLayoutXmlSerializer

The BarLayoutXmlSerializer to use.

WriteElementsToXml(BarLayoutXmlSerializer)

Serializes the child element data for the BarCommand to XML.

protected virtual void WriteElementsToXml(BarLayoutXmlSerializer serializer)
Parameter Type Description
serializer BarLayoutXmlSerializer

The BarLayoutXmlSerializer to use.

Events

Closed

Occurs after the popup menu is closed.

public event EventHandler Closed

Event Type

EventHandler

Inherited Members