鼠标双击MSFlexGrid1 表格输入数据问题。。。

来源:百度知道 编辑:UC知道 时间:2024/06/11 20:10:20
我建立了一个 MSFlexGrid1 表格控件。。我想在运行的时候 鼠标双击表格就出现录入提示。 请问高手怎么做? 录入后还要保存 请问怎么做?? 谢谢、、、、、麻烦给出代码 谢谢拉

MSFlexGrid1 自身是没有编辑功能的..

想实现这样的功能,大多是用一个隐藏着的text来实现的.
当双击单元格时. text1.使用move方法 到此格位置,且大小与单元格相同.
然后text1内容为单元格的内容

当text1失去焦点时,隐藏,且将内容写回到单元格内.

================转一个我使用MSH表格的收的同样功能,操作是一样的==========

Sub editdata()
With MSdata
tb.Left = .CellLeft + .Left - 10
tb.Top = .CellTop + .Top - 10
tb.Width = .CellWidth - 5
tb.Height = .CellHeight - 5
tb.Visible = True
tb.SetFocus
Me.tb = .Text
Me.tb.Tag = faIndex(.row, .col)
Me.tb.SetFocus
Me.tb.SelStart = Len(Me.tb)
End With
End Sub
Function faIndex(row As Integer, col As Integer) As Long
faIndex = row * MSdata.Cols + col
End Function

Private Sub tb_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
With MSdata
If .col = 4 Or (.col >= 6 And .col <= 10) Then
Call isnum(