Delete键
行选择时,一行或者多行点击键盘的Delete键,
怎样删除被选择行中所有的ReadOnly的项目, 默认情况下按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
非常感谢,
什么时候才能变得跟版主一样厉害呀:-D 不客气,你也很厉害的,大家关注的领域不一样。
页:
[1]