ContextMenuStrip Constructors

Definition

Initializes a new instance of the ContextMenuStrip class.

Overloads

ContextMenuStrip()

Initializes a new instance of the ContextMenuStrip class.

ContextMenuStrip(IContainer)

Initializes a new instance of the ContextMenuStrip class and associates it with the specified container.

ContextMenuStrip()

Source:
ContextMenuStrip.cs
Source:
ContextMenuStrip.cs
Source:
ContextMenuStrip.cs

Initializes a new instance of the ContextMenuStrip class.

C#
public ContextMenuStrip();

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

ContextMenuStrip(IContainer)

Source:
ContextMenuStrip.cs
Source:
ContextMenuStrip.cs
Source:
ContextMenuStrip.cs

Initializes a new instance of the ContextMenuStrip class and associates it with the specified container.

C#
public ContextMenuStrip(System.ComponentModel.IContainer container);

Parameters

container
IContainer

A component that implements IContainer that is the container of the ContextMenuStrip.

Remarks

Use this constructor to ensure that the ContextMenuStrip is disposed of properly, since it is not a child of the form.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9