利用 ToolsTip 动态展示提示信息
#Region "动态展示辅助提示信息 ToolTip"
Private Sub DGV_RecordsetList_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DGV_RecordsetList.CellMouseClick
If e.RowIndex < 0 OrElse e.ColumnIndex < 0 Then
Exit Sub
ElseIf e.Button = Windows.Forms.MouseButtons.Left Then
显示提示信息(e.RowIndex)
End If
End Sub
Private Sub 显示提示信息(ByVal RowIndex As Integer)
With DGV_RecordsetList
'信息字符串拼接
Dim ToolStr As String = "节目ID:" & .Rows(RowIndex).Cells(.Columns("节目ID").Index).Value & " " & _
"上载题名:" & .Rows(RowIndex).Cells(.Columns("上载题名").Index).Value & vbCrLf & _
'....
"接收题名:" & .Rows(RowIndex).Cells(.Columns("接收题名").Index).Value
If .Rows(RowIndex).Cells(12).Value > 4 Then
ToolStr &= vbCrLf & vbCrLf & _
"编目题名:" & .Rows(RowIndex).Cells(.Columns("编目题名").Index).Value & vbCrLf & vbCrLf & _
'... ...
"二审完成日期:" & .Rows(RowIndex).Cells(.Columns("二审完成日期").Index).Value
End If
Dim dp As New Point
dp = PointToClient(MousePosition) '将屏幕鼠标坐标转为工作区域坐标
dp.X += 10
ToolTip1.Show(ToolStr, Me, dp) ' New Point(PointToClient( MousePosition)))
End With
End Sub
Private Sub DGV_RecordsetList_CellMouseLeave(sender As Object, e As DataGridViewCellEventArgs) Handles DGV_RecordsetList.CellMouseLeave
ToolTip1.Hide(Me)
End Sub
#End Region
1万+

被折叠的 条评论
为什么被折叠?



