Option ExplicitPrivate Sub Form_Load() Dim i As Integer Dim j As Integer For i = 0 To 5 For j = 0 To 4 Me.MSHFlexGrid1.TextMatrix(i, j) = j + 1 Next Next End SubPrivate Sub MSHFlexGrid1_Click() Dim x As Integer Dim y As Integer Dim t As String x = Me.MSHFlexGrid1.Row y = Me.MSHFlexGrid1.Col t = Me.MSHFlexGrid1.TextMatrix(x, y) Debug.Print t End Sub指定一下就不会只是表头了^_^
Dim i As Integer
Dim j As Integer
For i = 0 To 5
For j = 0 To 4
Me.MSHFlexGrid1.TextMatrix(i, j) = j + 1
Next
Next
End SubPrivate Sub MSHFlexGrid1_Click()
Dim x As Integer
Dim y As Integer
Dim t As String
x = Me.MSHFlexGrid1.Row
y = Me.MSHFlexGrid1.Col
t = Me.MSHFlexGrid1.TextMatrix(x, y)
Debug.Print t
End Sub指定一下就不会只是表头了^_^
在单击mshFlexGrid时
我怎样知道单击的是表头,和所单击是第几列
如果是行的话,那(0,x),这样的话一定会是行表头
如果是列的话,那(x,0),这样的话应该会是列表头所单击的列就可以用x=mshflexgrid1.col;y=mshflexgrid1.row来固定了吧^_^
And m_MSHFlexGrid1.Row = 1 Then '当前选择第一行
i = m_MSHFlexGrid1.Col '获得当前列
End If