回复 1楼miyaminn的帖子
可以通过自定义快捷键动作实现:
- Public Class Form1
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim dt As New FarPoint.Win.Spread.CellType.DateTimeCellType
- FpSpread1.ActiveSheet.Columns(0).CellType = dt
- Dim txt As New FarPoint.Win.Spread.CellType.TextCellType()
- txt.CharacterCasing = CharacterCasing.Upper
- txt.CharacterSet = FarPoint.Win.Spread.CellType.CharacterSet.Ascii
- txt.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show
- txt.MaxLength = 40
- txt.Multiline = True
- txt.PasswordChar = "*"
- txt.ScrollBars = ScrollBars.Vertical
- txt.Static = True
- FpSpread1.Sheets(0).Columns(1).CellType = txt
- FpSpread1.Sheets(0).Cells(0, 1).Text = "This is a text cell. It can provide a wide range of" & _
- " functionality for handling a large amount of data that a user might want to include" & _
- " in a single cell."
- Dim im As New InputMap
- im = FpSpread1.GetInputMap(InputMapMode.WhenFocused)
- Dim am As ActionMap
- am = FpSpread1.GetActionMap()
- im.Put(New Keystroke(Keys.F3, Keys.None), "NewControlHomeAction")
- am.Put("NewControlHomeAction", New NewControlHomeAction())
- im.Put(New Keystroke(Keys.F4, Keys.None), "NewControlHomeAction")
- am.Put("NewControlHomeAction", New NewControlHomeAction())
- End Sub
- End Class
- Public Class NewControlHomeAction
- Inherits FarPoint.Win.Spread.Action
- Public Overrides Sub PerformAction(source As Object)
- If TypeOf source Is SpreadView Then
- Dim spread As SpreadView = DirectCast(source, SpreadView)
- If TypeOf spread.Sheets(spread.ActiveSheetIndex).ActiveColumn.CellType Is FarPoint.Win.Spread.CellType.DateTimeCellType Then
- spread.EditMode = True
- Else
- spread.EditMode = False
- End If
- End If
- End Sub
- End Class
复制代码 |