7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Form_Load()
Dim i As Long
With MSHFlexGrid1
For i = 0 To .Cols - 1
.ColWidth(i) = 1000'ColWidth默认为-1 改为1000(或其它值)才能保证MouseDown事件的代码正常使用
Next
End With
End Sub
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With MSHFlexGrid1
If y > .RowPos(.Rows - 1) + .RowHeight(.Rows - 1) Or x > .ColPos(.Cols - 1) + .ColWidth(.Cols - 1) Then
'Print .Col
.HighLight = flexHighlightNever
.Row = 0
.Col = 0
Else
.HighLight = flexHighlightAlways
End If
End With
End Sub
Private Sub MSHFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With MSHFlexGrid1
If y > .CellTop + .CellHeight Or x > .CellLeft + .CellWidth Then
.Row = 0
.Col = 0
.HighLight = flexHighlightNever
Else
.HighLight = flexHighlightAlways
End If
End With
End Sub