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

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

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)

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

放置 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)

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

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)

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

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)

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

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

控件(通常为位置 ToolStripDropDownButtonToolStripDropDown 引用点)。

position
Point

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

例外

参数 control 指定的控件为 null.

适用于

Show(Control, Point, ToolStripDropDownDirection)

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

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

控件(通常为位置 ToolStripDropDownButtonToolStripDropDown 引用点)。

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)

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

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

控件(通常为位置 ToolStripDropDownButtonToolStripDropDown 引用点)。

x
Int32

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

y
Int32

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

例外

参数 control 指定的控件为 null.

适用于