Dim re As New Regex("/s+") '寻找单元格中可能存在的空格 Dim T As Integer With ToolTip1 .IsBalloon = True .ToolTipIcon = ToolTipIcon.Error .UseAnimation = True .UseFading = True End With For T = 0 To DataGridView1.Rows.Count - 1 Dim m As Match = re.Match(DataGridView1.Rows(T).Cells(1).Value) If m.Success Then 'ToolTip1.Show("文本中含有空格",Me.DataGridView1,DataGridView1.CurrentCell.ContentBounds.X,DataGridView1.CurrentCell.ContentBounds.Y,3000) '看不到气泡 'ToolTip1.Show("文本中含有空格",DataGridView1.CurrentCellAddress.X,DataGridView1.CurrentCellAddress.Y,DataGridView1.Width,DataGridView1.Height,3000) '看不到气泡 'DataGridView1.Rows(T).Cells(1).ToolTipText = "文本中含有空格" '可见提示,但是只有当鼠标经过时才有提示信息,不能及时有效地提醒。 ToolTip1.SetToolTip(DataGridView1,"文本中含有空格") '看不到气泡 Else exit sub End If Next
存疑,是冲突吗?还是自己错了?