GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : CellMouseDown Event |
<SRDescriptionAttribute("Occurs when the user presses a mouse button while the mouse pointer is within the boundaries of a cell.")> <SRCategoryAttribute("Mouse")> Public Event CellMouseDown As EventHandler(Of CellMouseEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of CellMouseEventArgs) AddHandler instance.CellMouseDown, handler
[SRDescription("Occurs when the user presses a mouse button while the mouse pointer is within the boundaries of a cell.")] [SRCategory("Mouse")] public event EventHandler<CellMouseEventArgs> CellMouseDown
The event handler receives an argument of type CellMouseEventArgs containing data related to this event. The following CellMouseEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Button | (Inherited from System.Windows.Forms.MouseEventArgs) |
CellIndex | Gets the cell index in its parent Section. |
CellName | Gets the cell name. |
Clicks | (Inherited from System.Windows.Forms.MouseEventArgs) |
Delta | (Inherited from System.Windows.Forms.MouseEventArgs) |
Location | (Inherited from System.Windows.Forms.MouseEventArgs) |
RowIndex | Gets the index of the owner Row that the event occurs for. |
Scope | Gets the cell area that the event occurs for. |
SectionIndex | Gets the index of the owner Section that the event occurs for. |
X | (Inherited from System.Windows.Forms.MouseEventArgs) |
Y | (Inherited from System.Windows.Forms.MouseEventArgs) |
void gcMultiRow1_CellMouseDown(object sender, CellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (e.Scope == CellScope.Row && gcMultiRow1.Template.Row.Cells[e.CellIndex].Selectable) { gcMultiRow1.CurrentCellPosition = new CellPosition(e.Scope, e.SectionIndex, e.CellIndex); } if (gcMultiRow1.GetValue(e.SectionIndex, e.CellIndex) != null) { cut.Enabled = true; copy.Enabled = true; } else { cut.Enabled = false; copy.Enabled = false; } if (e.Scope == CellScope.Row && e.SectionIndex != gcMultiRow1.RowCount - 1) { sectionMenuStrip.Enabled = true; sectionMenuStrip.Tag = new CellPosition(e.Scope, e.SectionIndex, e.CellIndex); } else { sectionMenuStrip.Enabled = false; } if (Clipboard.ContainsText()) { paste.Enabled = true; } else { paste.Enabled = false; } } }
Private Sub gcMultiRow1_CellMouseDown(ByVal sender As Object, ByVal e As CellMouseEventArgs) Handles gcMultiRow1.CellMouseDown If e.Button = MouseButtons.Right Then If e.Scope = CellScope.Row AndAlso gcMultiRow1.Template.Row.Cells(e.CellIndex).Selectable Then gcMultiRow1.CurrentCellPosition = New CellPosition(e.Scope, e.SectionIndex, e.CellIndex) End If If gcMultiRow1.GetValue(e.SectionIndex, e.CellIndex) <> Nothing Then cut.Enabled = True copy.Enabled = True Else cut.Enabled = False copy.Enabled = False End If If e.Scope = CellScope.Row AndAlso e.SectionIndex <> gcMultiRow1.RowCount - 1 Then sectionMenuStrip.Enabled = True sectionMenuStrip.Tag = New CellPosition(e.Scope, e.SectionIndex, e.CellIndex) Else sectionMenuStrip.Enabled = False End If If Clipboard.ContainsText() Then paste.Enabled = True Else paste.Enabled = False End If End If 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