1

我希望在 vb.net winforms 的绑定数据网格中的每一行中添加一个工具提示。如何才能做到这一点?

4

3 回答 3

1

我自己没有尝试过,但我会试一试:

System.Windows.Forms.ToolTip formToolTip = new System.Windows.Forms.ToolTip();
formToolTip .SetToolTip(item, "Row Tooltip");

对应item于您为其设置工具提示的单元格的位置。

于 2008-10-20T20:23:35.777 回答
0
row.cells[indexof].ToolTipText= "tootip here".

在winforms中,看起来你不能做整行。

如果您需要整行,您可以遍历单元格。

 foreach (DataGridViewCell cell in row.Cells)
                {
                    cell.ToolTipText = "tooltip here";
                }
于 2008-11-10T17:06:07.013 回答
0
If TypeOf control Is TabControl Then
    For Each control1 In control.Controls
        If TypeOf control1 Is TabPage Then
            strControlText = fnGetLanguage(control1.Text)
        End If
        For Each control2 In control1.Controls
            If TypeOf control2 Is label Then
                strControlText = control2.Text
                ' strToolTipText = ToolTip.GetToolTip(control2)
                If strControlText.Contains("*") Then
                    strDizi = Split(strControlText, " ")
                    strControlText = fnGetLanguage(strDizi(0))
                Else
                    strControlText = fnGetLanguage(control2.Text)
                End If
            ElseIf TypeOf control2 Is DataGridView Then
                For i = 0 To control2.ColumnCount - 1
                    strControlText = control2.Columns(i).HeaderText
                    strControlText = fnGetLanguage(strControlText)
                Next
            ElseIf TypeOf control2 Is ComboBox Then
                strControlText = control2.Text
                'strToolTipText = ToolTip.GetToolTip(control2)
                If control2.DataSource Is Nothing Then
                    For i = 0 To control2.Items.Count - 1
                        strControlText = control2.Items(i)
                        strControlText = fnGetLanguage(strControlText)
                    Next
                Else
                    For i = 0 To control2.Items.Count - 1
                        strControlText = control2.Items(i).ToString
                        strControlText = fnGetLanguage(strControlText)
                    Next
                End If
            End If
        Next
    Next
End If
于 2009-07-29T08:14:25.363 回答