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