ToolStripDropDown.Show 方法

定义

相对于指定的坐标定位 ToolStripDropDown

重载

Show()

在其默认位置显示 ToolStripDropDown 控件。

Show(Point)

相对于指定的屏幕位置定位 ToolStripDropDown

Show(Point, ToolStripDropDownDirection)

相对于指定的控件位置并以相对于父控件的指定方向定位 ToolStripDropDown

Show(Int32, Int32)

相对于指定的屏幕坐标定位 ToolStripDropDown

Show(Control, Point)

相对于指定的控件位置定位 ToolStripDropDown

Show(Control, Point, ToolStripDropDownDirection)

相对于指定位置的指定控件并以相对于父控件的指定方向定位 ToolStripDropDown

Show(Control, Int32, Int32)

相对于指定控件的水平和垂直屏幕坐标定位 ToolStripDropDown

Show()

在其默认位置显示 ToolStripDropDown 控件。

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

示例

下面的代码示例演示如何在 ToolStripDropDown 控件的默认位置显示控件。

// 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)

相对于指定的屏幕位置定位 ToolStripDropDown

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

屏幕左上角的水平和垂直位置(以像素为单位)。

示例

下面的代码示例演示如何在固定点显示 ToolStripDropDown 控件。

// 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)

相对于指定的控件位置并以相对于父控件的指定方向定位 ToolStripDropDown

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

引用控件左上角的水平和垂直位置(以像素为单位)。

示例

下面的代码示例演示如何在指定方向的 ToolStripDropDown 固定点显示控件。

// 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)

相对于指定的屏幕坐标定位 ToolStripDropDown

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

水平屏幕坐标(以像素为单位)。

y
Int32

垂直屏幕坐标(以像素为单位)。

适用于

Show(Control, Point)

相对于指定的控件位置定位 ToolStripDropDown

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
Public Sub Show (control As Control, position As Point)

参数

control
Control

作为 ToolStripDropDownButton 位置的参考点的控件(通常是 ToolStripDropDown)。

position
Point

引用控件左上角的水平和垂直位置(以像素为单位)。

例外

control 参数指定的控件是 null

适用于

Show(Control, Point, ToolStripDropDownDirection)

相对于指定位置的指定控件并以相对于父控件的指定方向定位 ToolStripDropDown

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
Public Sub Show (control As Control, position As Point, direction As ToolStripDropDownDirection)

参数

control
Control

作为 ToolStripDropDownButton 位置的参考点的控件(通常是 ToolStripDropDown)。

position
Point

引用控件左上角的水平和垂直位置(以像素为单位)。

例外

control 参数指定的控件是 null

示例

下面的代码示例演示如何显示 ToolStripDropDown 相对于父控件的控件。

// 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)

相对于指定控件的水平和垂直屏幕坐标定位 ToolStripDropDown

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
Public Sub Show (control As Control, x As Integer, y As Integer)

参数

control
Control

作为 ToolStripDropDownButton 位置的参考点的控件(通常是 ToolStripDropDown)。

x
Int32

控件的水平屏幕坐标(以像素为单位)。

y
Int32

控件的垂直屏幕坐标(以像素为单位)。

例外

control 参数指定的控件是 null

适用于