GrapeCity.Win.MultiRow Namespace > Section Class : ContextMenuStrip Property |
<BrowsableAttribute(False)> <SRDescriptionAttribute("Indicates the shortcut menu to display when the user right-clicks the Section. ")> <DefaultValueAttribute()> <SRCategoryAttribute("Behavior")> Public Property ContextMenuStrip As ContextMenuStrip
Dim instance As Section Dim value As ContextMenuStrip instance.ContextMenuStrip = value value = instance.ContextMenuStrip
[Browsable(false)] [SRDescription("Indicates the shortcut menu to display when the user right-clicks the Section. ")] [DefaultValue()] [SRCategory("Behavior")] public ContextMenuStrip ContextMenuStrip {get; set;}
When you right-click a Cell, if the Cell.ContextMenuStrip property is not set, the section's menu is displayed. If the section's ContextMenuStrip is also not set, then the GcMultiRow's ContextMenuStrip is displayed.
You can handle the CellContextMenuStripNeeded or SectionContextMenuStripNeeded event in data binding or virtual mode when working with large amounts of data to avoid performance penalties.
It is not recommended that you set this property before the owner Template is added to GcMultiRow.
class ContextMenuStripDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private FlowLayoutPanel panel = new FlowLayoutPanel(); private Label label = new Label(); ContextMenuStrip sectionMenuStrip = new ContextMenuStrip(); ContextMenuStrip cellMenu = new ContextMenuStrip(); ToolStripButton hideRow = new ToolStripButton("Hide Current Row"); ToolStripButton cut = new ToolStripButton("Cut"); ToolStripButton copy = new ToolStripButton("Copy"); ToolStripButton paste = new ToolStripButton("Paste"); public ContextMenuStripDemo() { this.Text = "ContextMenuStrip Demo"; this.Size = new Size(700, 600); // Add MultiRow to Form this.gcMultiRow1.Dock = DockStyle.Fill; this.Controls.Add(this.gcMultiRow1); label.Dock = DockStyle.Bottom; label.BackColor = SystemColors.Info; label.Text = "Right Click the RowHeader to hide the row, right click the Cell to cut, copy or paste."; this.Controls.Add(label); this.Load += new EventHandler(Form1_Load); hideRow.Width = 90; hideRow.Click += new EventHandler(hideRow_Click); cut.Click += new EventHandler(cut_Click); copy.Click += new EventHandler(copy_Click); paste.Click += new EventHandler(paste_Click); sectionMenuStrip.Items.AddRange(new ToolStripItem[] { hideRow }); cellMenu.Items.AddRange(new ToolStripItem[] { cut, copy, paste }); }
Class ContextMenuStripDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private panel As New FlowLayoutPanel() Private label As New Label() Friend WithEvents sectionMenuStrip As New ContextMenuStrip() Friend WithEvents cellMenu As New ContextMenuStrip() Friend WithEvents hideRow As New ToolStripButton("Hide Current Row") Friend WithEvents cut As New ToolStripButton("Cut") Friend WithEvents copy As New ToolStripButton("Copy") Friend WithEvents paste As New ToolStripButton("Paste") Public Sub New() Me.Text = "ContextMenuStrip Demo" Me.Size = New Size(700, 600) ' Add MultiRow to Form Me.gcMultiRow1.Dock = DockStyle.Fill Me.Controls.Add(Me.gcMultiRow1) label.Dock = DockStyle.Bottom label.BackColor = SystemColors.Info label.Text = "Right Click the RowHeader to hide the row, right click the Cell to cut, copy or paste." Me.Controls.Add(label) hideRow.Width = 90 sectionMenuStrip.Items.AddRange(New ToolStripItem() {hideRow}) cellMenu.Items.AddRange(New ToolStripItem() {cut, copy, paste}) End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2