16,554
社区成员
发帖
与我相关
我的任务
分享
Private Sub DataGridView1_MouseHover(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.MouseHover
MsgBox(e.RowIndex)
End Sub
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
DataGridView1.RowCount = 10
DataGridView1.ColumnCount = 10
DataGridView1.Rows(2).Cells(2).Value = "100空" & Space(100) & "格"
End Sub
Private Sub DataGridView1_CellToolTipTextNeeded(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs) Handles DataGridView1.CellToolTipTextNeeded
DataGridView1.Rows(2).Cells(2).ToolTipText = e.ColumnIndex.ToString() + ", " + e.RowIndex.ToString()
End Sub
End Class
Private Sub DataGridView1_CellToolTipTextNeeded(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellToolTipTextNeededEventArgs) Handles DataGridView1.CellToolTipTextNeeded
DataGridView1.Rows(2).Cells(2).Value = "100空" & Space(100) & "格"
DataGridView1.Rows(2).Cells(2).ToolTipText = e.ColumnIndex.ToString() + ", " + e.RowIndex.ToString()
End Sub
DataGridView.ShowCellToolTips = True 的情况下, 单元格的 ToolTip 可以表示出来。对于单元格窄小,无法完全显示的单元格, ToolTip 可以显示必要的信息。
(网上抄录)
上面这句话搞不懂,比如单元格的
DataGridView1.Rows(3).Cells(3).Value =“100空”& Space(100) &“格”
同时:
DataGridView1.Rows(3).Cells(3).ToolTipText = e.ColumnIndex.ToString() + ", " + e.RowIndex.ToString()
那么当我将鼠标停留在3,3单元格时,会显示哪句代码呢?
实际测试会显示100个空格那句,那我想达到的效果却是第二句代码,请指教。