ModulePage.ContextMenuStrip Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece el menú contextual de la página.
public:
virtual property System::Windows::Forms::ContextMenuStrip ^ ContextMenuStrip { System::Windows::Forms::ContextMenuStrip ^ get(); void set(System::Windows::Forms::ContextMenuStrip ^ value); };
public override System.Windows.Forms.ContextMenuStrip ContextMenuStrip { get; set; }
member this.ContextMenuStrip : System.Windows.Forms.ContextMenuStrip with get, set
Public Overrides Property ContextMenuStrip As ContextMenuStrip
Valor de propiedad
Objeto ContextMenuStrip o null
si no se ha asignado un valor.
Ejemplos
En el ejemplo siguiente se crea un menú contextual y se rellena con controles.
void initCntxMenu() {
ContextMenuStrip = new ContextMenuStrip();
InitializeComponent2();
}
internal partial class DemoPage : ModulePage {
private ToolStripMenuItem _tsm1;
private ToolStripMenuItem _tsm2;
private ToolStripMenuItem _tsm3;
private void InitializeComponent2() {
_tsm1 = new System.Windows.Forms.ToolStripMenuItem();
_tsm2 = new System.Windows.Forms.ToolStripMenuItem();
_tsm3 = new System.Windows.Forms.ToolStripMenuItem();
//
// contextMenuStrip1
//
ContextMenuStrip.Items.AddRange(
new System.Windows.Forms.ToolStripItem[] {
_tsm1,
_tsm2,
_tsm3});
ContextMenuStrip.Name = "contextMenuStrip1";
ContextMenuStrip.Size = new System.Drawing.Size(180, 70);
//
// _tsm1
//
_tsm1.Name = "_tsm1";
_tsm1.Size = new System.Drawing.Size(179, 22);
_tsm1.Text = "_tsm1 info";
_tsm1.Click += new EventHandler(_tsm1_Click);
//
// _tsm2
//
_tsm2.Name = "_tsm2";
_tsm2.Size = new System.Drawing.Size(179, 22);
_tsm2.Text = "_tsm2 any questions?";
//
// _tsm3
//
_tsm3.Name = "_tsm3";
_tsm3.Size = new System.Drawing.Size(179, 22);
_tsm3.Text = "_tsm3 the end";
//
// Form1
//
ContextMenuStrip.ResumeLayout(false);
}
void _tsm1_Click(object sender, EventArgs e) {
MessageBox.Show("congrad", sender.ToString());
}
}