ToolStripDropDown.Show Method

Definition

Positions the ToolStripDropDown relative to the specified coordinates.

Overloads

Show()

Displays the ToolStripDropDown control in its default position.

Show(Point)

Positions the ToolStripDropDown relative to the specified screen location.

Show(Point, ToolStripDropDownDirection)

Positions the ToolStripDropDown relative to the specified control location and with the specified direction relative to the parent control.

Show(Int32, Int32)

Positions the ToolStripDropDown relative to the specified screen coordinates.

Show(Control, Point)

Positions the ToolStripDropDown relative to the specified control location.

Show(Control, Point, ToolStripDropDownDirection)

Positions the ToolStripDropDown relative to the specified control at the specified location and with the specified direction relative to the parent control.

Show(Control, Int32, Int32)

Positions the ToolStripDropDown relative to the specified control's horizontal and vertical screen coordinates.

Show()

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Displays the ToolStripDropDown control in its default position.

[System.ComponentModel.Browsable(false)]
public void Show ();
Attributes

Examples

The following code example demonstrates how to display the ToolStripDropDown control at its default position.

// This method calls the ToolStripDropDown control's Show 
// method to display the ContextMenuStrip in its 
// default location.
private void showButton_Click(object sender, EventArgs e)
{
    this.contextMenuStrip1.Show();
}

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

Show(Point)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Positions the ToolStripDropDown relative to the specified screen location.

public void Show (System.Drawing.Point screenLocation);

Parameters

screenLocation
Point

The horizontal and vertical location of the screen's upper-left corner, in pixels.

Examples

The following code example demonstrates how to display the ToolStripDropDown control at a fixed point.

// This method calls the ToolStripDropDown control's Show 
// method to display the ContextMenuStrip at a fixed point.
private void showAtPointButton_Click(object sender, EventArgs e)
{
    this.contextMenuStrip1.Show(23, 55);
}

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

Show(Point, ToolStripDropDownDirection)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Positions the ToolStripDropDown relative to the specified control location and with the specified direction relative to the parent control.

public void Show (System.Drawing.Point position, System.Windows.Forms.ToolStripDropDownDirection direction);

Parameters

position
Point

The horizontal and vertical location of the reference control's upper-left corner, in pixels.

Examples

The following code example demonstrates how to display the ToolStripDropDown control at a fixed point in the specified direction.

// This method calls the ToolStripDropDown control's Show 
// method to display the ContextMenuStrip relative to the
// origin of the form. 
private void showRelativeButton_Click(object sender, EventArgs e)
{
    this.contextMenuStrip1.Show(this.Location, this.dropDownDirection);
}

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

Show(Int32, Int32)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Positions the ToolStripDropDown relative to the specified screen coordinates.

public void Show (int x, int y);

Parameters

x
Int32

The horizontal screen coordinate, in pixels.

y
Int32

The vertical screen coordinate, in pixels.

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

Show(Control, Point)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Positions the ToolStripDropDown relative to the specified control location.

public void Show (System.Windows.Forms.Control control, System.Drawing.Point position);

Parameters

control
Control

The control (typically, a ToolStripDropDownButton) that is the reference point for the ToolStripDropDown position.

position
Point

The horizontal and vertical location of the reference control's upper-left corner, in pixels.

Exceptions

The control specified by the control parameter is null.

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

Show(Control, Point, ToolStripDropDownDirection)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Positions the ToolStripDropDown relative to the specified control at the specified location and with the specified direction relative to the parent control.

public void Show (System.Windows.Forms.Control control, System.Drawing.Point position, System.Windows.Forms.ToolStripDropDownDirection direction);

Parameters

control
Control

The control (typically, a ToolStripDropDownButton) that is the reference point for the ToolStripDropDown position.

position
Point

The horizontal and vertical location of the reference control's upper-left corner, in pixels.

Exceptions

The control specified by the control parameter is null.

Examples

The following code example demonstrates how to display the ToolStripDropDown control relative to the parent control.

// This method calls the ToolStripDropDown control's Show 
// method to display the ContextMenuStrip relative to the
// owning control.
private void button1_MouseUp(object sender, MouseEventArgs e)
{
    Control c = sender as Control;
    if (e.Button == MouseButtons.Right)
    {
        this.contextMenuStrip1.Show(c, e.Location, this.dropDownDirection);
    }
}

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

Show(Control, Int32, Int32)

Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs
Source:
ToolStripDropDown.cs

Positions the ToolStripDropDown relative to the specified control's horizontal and vertical screen coordinates.

public void Show (System.Windows.Forms.Control control, int x, int y);

Parameters

control
Control

The control (typically, a ToolStripDropDownButton) that is the reference point for the ToolStripDropDown position.

x
Int32

The horizontal screen coordinate of the control, in pixels.

y
Int32

The vertical screen coordinate of the control, in pixels.

Exceptions

The control specified by the control parameter is null.

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