In This Article

PopupMenu Class

Represents a popup menu.

[TypeConverter(typeof(PopupMenuConverter))]
public class PopupMenu : MarshalByRefDisposableObject, IDisposable
Inheritance:
object MarshalByRefObject MarshalByRefDisposableObject object
Implements:
IDisposable

Constructors

PopupMenu(BarManager, string)

Initializes an instance of the 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 an instance of the class.

public PopupMenu(string key)
Parameter Type Description
key string

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

Properties

BarManager

The BarManager that is managing this object.

[Browsable(false)]
public BarManager? BarManager { get; }

Property Value

BarManager

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

[Browsable(false)]
public BarCommandLinkCollection CommandLinks { get; }

Property Value

BarCommandLinkCollection

Key

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

public string Key { get; set; }

Property Value

string

Tag

The object that contains user-defined data about the object.

[TypeConverter(typeof(StringConverter))]
public object? Tag { get; set; }

Property Value

object

ToolBarStyledMenuWrapWidth

The menu wrap width, in pixels.

public int ToolBarStyledMenuWrapWidth { get; set; }

Property Value

int

Remarks

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

UseToolBarStyle

Indicates whether to display the popup menu using a toolbar style.

public bool UseToolBarStyle { get; set; }

Property Value

bool:

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

Methods

Dispose(bool)

Releases the unmanaged resources used by the object and optionally releases the managed resources.

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

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method is called by the public Dispose method and the Finalize method. Dispose invokes this method with the disposing parameter set to true. Finalize invokes this method with disposing set to false.

OnClosed(EventArgs)

Raises the Closed event.

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

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

bool:

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

bool:

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, int)

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 int

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, bool)

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 location at which to display the popup menu.

isClientLocation bool

true when the point is relative to the ownerControl; otherwise, false when point is a screen location.

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

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 int

The amount to offset from the exclusion bounds.

Show(Control?, Rectangle, Corner, Orientation, int, bool)

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 int

The amount to offset from the exclusion bounds.

isClientBounds bool

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

Extension Methods