我用的是spread7
在spread7有个单元格使用的是GcDateTimeEditingControl。
现在其他的function key都能捕捉到,只有F5捕捉不到。总是执行它默认的操作(把单元格的值设置成当前系统日期)
我的使用方法如下:
'========================================================
Private Sub InitSpread()
With Me.sprList
.EditMode = True
.EditModePermanent = True Dim inputmap1 As New FarPoint.Win.Spread.InputMap()
Dim inputmap2 As New FarPoint.Win.Spread.InputMap()
inputmap1 = .GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.Escape, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F1, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F3, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F4, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F5, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F6, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F7, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F8, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F9, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F10, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F11, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.F12, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
inputmap2 = .GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
inputmap2.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
.Enabled = False
End With
End Sub
'========================================================
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
Try
Select Case keyData
Case Windows.Forms.Keys.Escape
Me.MsubESCKeyEvent()
Case Windows.Forms.Keys.F1
Me.MsubF1KeyEvent()
Case Windows.Forms.Keys.F5
Me.MsubF5KeyEvent()
End Select
Catch ex As Exception
Throw ex
End Try
End Function |
|