SpreadSheetGear右键菜单在Vb.Net中编辑

我可以:在SpreatSheetGear中编辑所选单元格的右键单击菜单,添加一个选项,如合并,然后处理select该菜单项的事件点击? 在此先感谢分享一些想法。

您应该可以将新的ToolStripItem添加到WorkbookView.ContextMenuStrip ( ContextMenuStrip属性从Control类inheritance):

 ' 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