ToolStripDropDown.Show ToolStripDropDown.Show ToolStripDropDown.Show ToolStripDropDown.Show Method

定义

相对于指定的坐标定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified coordinates.

重载

Show() Show() Show() Show()

在其默认位置显示 ToolStripDropDown 控件。Displays the ToolStripDropDown control in its default position.

Show(Point) Show(Point) Show(Point) Show(Point)

相对于指定的屏幕位置定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified screen location.

Show(Point, ToolStripDropDownDirection) Show(Point, ToolStripDropDownDirection) Show(Point, ToolStripDropDownDirection) Show(Point, ToolStripDropDownDirection)

相对于指定的控件位置并以相对于父控件的指定方向定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified control location and with the specified direction relative to the parent control.

Show(Int32, Int32) Show(Int32, Int32) Show(Int32, Int32) Show(Int32, Int32)

相对于指定的屏幕坐标定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified screen coordinates.

Show(Control, Point) Show(Control, Point) Show(Control, Point)

相对于指定的控件位置定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified control location.

Show(Control, Point, ToolStripDropDownDirection) Show(Control, Point, ToolStripDropDownDirection) Show(Control, Point, ToolStripDropDownDirection)

相对于指定位置的指定控件并以相对于父控件的指定方向定位 ToolStripDropDownPositions 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) Show(Control, Int32, Int32) Show(Control, Int32, Int32)

相对于指定控件的水平和垂直屏幕坐标定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified control's horizontal and vertical screen coordinates.

Show() Show() Show() Show()

在其默认位置显示 ToolStripDropDown 控件。Displays the ToolStripDropDown control in its default position.

public:
 void Show();
[System.ComponentModel.Browsable(false)]
public void Show ();
override this.Show : unit -> unit
Public Sub Show ()

示例

下面的代码示例演示如何在ToolStripDropDown控件的默认位置显示控件。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();
}
' This method calls the ToolStripDropDown control's Show 
' method to display the ContextMenuStrip in its 
' default location.
Private Sub showButton_Click(sender As Object, e As EventArgs) Handles showButton.Click
   Me.contextMenuStrip1.Show()
 End Sub

Show(Point) Show(Point) Show(Point) Show(Point)

相对于指定的屏幕位置定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified screen location.

public:
 void Show(System::Drawing::Point screenLocation);
public void Show (System.Drawing.Point screenLocation);
override this.Show : System.Drawing.Point -> unit
Public Sub Show (screenLocation As Point)

参数

screenLocation
Point Point Point Point

屏幕左上角的水平和垂直位置,以像素为单位。The horizontal and vertical location of the screen's upper-left corner, in pixels.

示例

下面的代码示例演示如何在固定点ToolStripDropDown显示控件。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);
}
' This method calls the ToolStripDropDown control's Show 
' method to display the ContextMenuStrip at a fixed point.
Private Sub showAtPointButton_Click(sender As Object, e As EventArgs) Handles showAtPointButton.Click, button2.Click
   Me.contextMenuStrip1.Show(23, 55)
 End Sub

Show(Point, ToolStripDropDownDirection) Show(Point, ToolStripDropDownDirection) Show(Point, ToolStripDropDownDirection) Show(Point, ToolStripDropDownDirection)

相对于指定的控件位置并以相对于父控件的指定方向定位 ToolStripDropDownPositions 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);
public void Show (System.Drawing.Point position, System.Windows.Forms.ToolStripDropDownDirection direction);
override this.Show : System.Drawing.Point * System.Windows.Forms.ToolStripDropDownDirection -> unit
Public Sub Show (position As Point, direction As ToolStripDropDownDirection)

参数

position
Point Point Point Point

引用控件左上角的水平和垂直位置,以像素为单位。The horizontal and vertical location of the reference control's upper-left corner, in pixels.

示例

下面的代码示例演示如何在指定方向ToolStripDropDown的固定点上显示控件。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);
}
' This method calls the ToolStripDropDown control's Show 
' method to display the ContextMenuStrip relative to the
' origin of the form. 
Private Sub showRelativeButton_Click(sender As Object, e As EventArgs)
   Me.contextMenuStrip1.Show(Me.Location, Me.dropDownDirection)
 End Sub

Show(Int32, Int32) Show(Int32, Int32) Show(Int32, Int32) Show(Int32, Int32)

相对于指定的屏幕坐标定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified screen coordinates.

public:
 void Show(int x, int y);
public void Show (int x, int y);
override this.Show : int * int -> unit
Public Sub Show (x As Integer, y As Integer)

参数

x
Int32 Int32 Int32 Int32

水平屏幕坐标(以像素为单位)。The horizontal screen coordinate, in pixels.

y
Int32 Int32 Int32 Int32

垂直屏幕坐标(以像素为单位)。The vertical screen coordinate, in pixels.

Show(Control, Point) Show(Control, Point) Show(Control, Point)

相对于指定的控件位置定位 ToolStripDropDownPositions the ToolStripDropDown relative to the specified control location.

public:
 void Show(System::Windows::Forms::Control ^ control, System::Drawing::Point position);
public void Show (System.Windows.Forms.Control control, System.Drawing.Point position);
override this.Show : System.Windows.Forms.Control * System.Drawing.Point -> unit

参数

control
Control Control Control Control

作为 ToolStripDropDownButton 位置的参考点的控件(通常是 ToolStripDropDown)。The control (typically, a ToolStripDropDownButton) that is the reference point for the ToolStripDropDown position.

position
Point Point Point Point

引用控件左上角的水平和垂直位置,以像素为单位。The horizontal and vertical location of the reference control's upper-left corner, in pixels.

异常

control 参数指定的控件是 nullThe control specified by the control parameter is null.

Show(Control, Point, ToolStripDropDownDirection) Show(Control, Point, ToolStripDropDownDirection) Show(Control, Point, ToolStripDropDownDirection)

相对于指定位置的指定控件并以相对于父控件的指定方向定位 ToolStripDropDownPositions 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);
public void Show (System.Windows.Forms.Control control, System.Drawing.Point position, System.Windows.Forms.ToolStripDropDownDirection direction);
override this.Show : System.Windows.Forms.Control * System.Drawing.Point * System.Windows.Forms.ToolStripDropDownDirection -> unit

参数

control
Control Control Control Control

作为 ToolStripDropDownButton 位置的参考点的控件(通常是 ToolStripDropDown)。The control (typically, a ToolStripDropDownButton) that is the reference point for the ToolStripDropDown position.

position
Point Point Point Point

引用控件左上角的水平和垂直位置,以像素为单位。The horizontal and vertical location of the reference control's upper-left corner, in pixels.

异常

control 参数指定的控件是 nullThe control specified by the control parameter is null.

示例

下面的代码示例演示如何显示相对于ToolStripDropDown父控件的控件。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);
    }
}
' This method calls the ToolStripDropDown control's Show 
' method to display the ContextMenuStrip relative to the
' owning control.
Private Sub button1_MouseUp(sender As Object, e As MouseEventArgs) Handles button1.MouseUp
     Dim c As Control = CType(sender, Control)
   
     If e.Button = Windows.Forms.MouseButtons.Right Then
         Me.contextMenuStrip1.Show(c, e.Location, Me.dropDownDirection)
     End If
 End Sub

Show(Control, Int32, Int32) Show(Control, Int32, Int32) Show(Control, Int32, Int32)

相对于指定控件的水平和垂直屏幕坐标定位 ToolStripDropDownPositions 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);
public void Show (System.Windows.Forms.Control control, int x, int y);
override this.Show : System.Windows.Forms.Control * int * int -> unit

参数

control
Control Control Control Control

作为 ToolStripDropDownButton 位置的参考点的控件(通常是 ToolStripDropDown)。The control (typically, a ToolStripDropDownButton) that is the reference point for the ToolStripDropDown position.

x
Int32 Int32 Int32 Int32

控件的水平屏幕坐标(以像素为单位)。The horizontal screen coordinate of the control, in pixels.

y
Int32 Int32 Int32 Int32

控件的垂直屏幕坐标(以像素为单位)。The vertical screen coordinate of the control, in pixels.

异常

control 参数指定的控件是 nullThe control specified by the control parameter is null.

适用于