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

適用於