DataGridView鼠标经过Cell时弹出对话框

该博客介绍了如何在Windows Forms应用程序中,当鼠标移动到DataGridView单元格上时,弹出一个对话框展示详细信息。通过HitTest方法获取单元格位置,并在特定条件下显示HourScheduleViewForm窗体,模拟Tooltip效果。代码中还包括了窗体关闭和位置设置的逻辑,以及防止多个窗体弹出的处理。 HourScheduleViewForm的初始化参数包括开始时间、结束时间等,提供了一种增强的用户交互体验。
摘要由CSDN通过智能技术生成
 Private Sub gdv_view_schedule_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gdv_view_schedule.MouseMove

        Dim hitCell As DataGridView.HitTestInfo = Me.gdv_view_schedule.HitTest(e.X, e.Y)
        Dim screenPoint As Point = Me.gdv_view_schedule.PointToScreen(New Point(e.X, e.Y))
        Dim row_index As Integer = hitCell.RowIndex
        Dim column_index As Integer = hitCell.ColumnIndex
        If row_index = -1 OrElse column_index = -1 Then
            Return
        End If
        Dim cell As DataGridViewCell = Me.gdv_view_schedule.Rows(row_index).Cells(column_index)
        Dim frist_cell, last_cell, next_cell As DataGridViewCell
        Dim start_time, end_time As DateTime

        If Not cell.Value Is Convert.DBNull Then

            If cell.Value = "Overlap" Then
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值