Can I: Edit the right click menu of selected cells of Sheet in SpreatSheetGear to add an option like Merge, and then handle the event of selection of that menu item click? Thanks in Advance for sharing some idea.
You ought to just be able add a new ToolStripItem to WorkbookView.ContextMenuStrip
(the ContextMenuStrip property is inherited from the Control class):
' Create and add new item to WorkbookView's context menu
Dim newItem As ToolStripItem = workbookView.ContextMenuStrip.Items.Add("Merge Cells")
' Add event handler
AddHandler newItem.Click, AddressOf MenuItemMergeCells_Click
...
Private Sub MenuItemMergeCells_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim item As ToolStripItem = CType(sender, ToolStripItem)
If item.Text = "Merge Cells" Then
workbookView.GetLock()
Try
' Merging is only valid for multi-cell ranges
If workbookView.RangeSelection.CellCount >= 2 Then
workbookView.RangeSelection.Merge()
End If
Finally
workbookView.ReleaseLock()
End Try
End If
End Sub