1.新增一个TextStr控件
2.函数
'方案界面及事件初始化
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call hfbinClick(MSHFlexGrid1, Combo1, TextStr)
End Sub
Private Sub hfbinClick(ByVal Hf As MSHFlexGrid, ByVal cb As ComboBox, ByVal txtS As TextBox)
Dim col As Integer
Dim row As Integer
col = MSHFlexGrid1.col
row = MSHFlexGrid1.row
Call bdText(txtS, MSHFlexGrid1.TextMatrix(row, col), Hf)
End Sub
'文本控件对象、默认值、当前HFGrid控件
Private Sub bdText(ByVal Txt As TextBox, ByVal str As String, ByVal Hf As MSHFlexGrid) '绑定文本数据
Txt.Width = Hf.CellWidth
Txt.Left = Hf.CellLeft + Hf.Left
Txt.Top = Hf.CellTop + Hf.Top
Txt.text = str
Txt.Visible = True
Txt.SetFocus
End Sub
Private Sub TextStr_Change()
Dim col As Integer
Dim row As Integer
col = MSHFlexGrid1.col
row = MSHFlexGrid1.row
MSHFlexGrid1.TextMatrix(row, col) = TextStr’当TextStr改变时将其写入对应的单元格
End Sub