(1)來源
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
(2)繼承層次
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ToolStrip
System.Windows.Forms.ToolStripDropDown
System.Windows.Forms.ToolStripDropDownMenu
System.Windows.Forms.ContextMenuStrip
(3)重要成員
Show(Point) :相對於指定的屏幕位置定位 ToolStripDropDown。
(4)例子
//在Form_Load響應函數中
contextMenuStrip1.Items.Add("apple");
contextMenuStrip1.Items.Add("banana");
contextMenuStrip1.Items.Add("pear");
//在鼠標按下響應函數中
if (e.Button == MouseButtons.Right)
{
contextMenuStrip1.Show(Cursor.Position);
}