默认情况下按Delete不能清除ReadOnlyCell的值。如果有这样的需求需要自定义Action。请参考以下代码。- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- GcMultiRow1.ShortcutKeyManager.Unregister(Keys.Delete)
- GcMultiRow1.ShortcutKeyManager.Register(New MyClearAction(), Keys.Delete)
- End Sub
复制代码- Public Class MyClearAction
- Implements IAction
- Public Function CanExecute(ByVal target As GrapeCity.Win.MultiRow.GcMultiRow) As Boolean Implements GrapeCity.Win.MultiRow.IAction.CanExecute
- If (target.SelectedCells.Count > 0) Then
- Return True
- End If
- Return False
- End Function
- Public ReadOnly Property DisplayName() As String Implements GrapeCity.Win.MultiRow.IAction.DisplayName
- Get
- Return "MyClearAction"
- End Get
- End Property
- Public Sub Execute(ByVal target As GrapeCity.Win.MultiRow.GcMultiRow) Implements GrapeCity.Win.MultiRow.IAction.Execute
- For Each Item As Cell In target.SelectedCells
- Item.Value = Nothing
- Next
- End Sub
- End Class
复制代码 |