msflexgrid在指定单元格中响应键盘事件
比如,第1列为"商品编号",在第一行“商品编号”中按下键盘,可响应事件,调出隐藏的textbox.
程序代码:
Dim a As Integer, b As Integer
Private Sub Form_Load()
MSFlexGrid1.Rows = 10
MSFlexGrid1.Cols = 10
End Sub
Private Sub EditBinName(a As Integer, b As Integer)
With MSFlexGrid1
Text1.Left = .Left + .ColPos(a) + 2 * Screen.TwipsPerPixelX
Text1.Top = .Top + .RowPos(b) + 2 * Screen.TwipsPerPixelY
Text1.Width = .ColWidth(a)
Text1.Text = .Text
Text1.SelStart = 0
Text1.SelLength = Len(BinNameText)
End With
Text1.Visible = True
Text1.SetFocus
End Sub
Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
a = MSFlexGrid1.MouseCol
b = MSFlexGrid1.MouseRow
Call EditBinName(a, b)
End If
End Sub








