ComponentOne
FlexGrid for WinForms
添加后台代码如下: int oldrow = -1; int oldcolumn = -1; void c1FlexGrid1_MouseMove(object sender, MouseEventArgs e) { // 获取当前鼠标所在单元格信息 C1.Win.C1FlexGrid.HitTestInfo hti = c1FlexGrid1.HitTest(e.X, e.Y); // 判断鼠标当前位置是否和上一位置有变化 if (hti.Row == oldrow && hti.Column == oldcolumn) { return; } else { oldrow = hti.Row; oldcolumn = hti.Column; } // 设置 C1Flexgrid 的 ToolTip if ((hti.Row != -1 && hti.Column != -1) && (c1FlexGrid1[hti.Row, hti.Column] != null)) { toolTip1.SetToolTip(c1FlexGrid1, c1FlexGrid1[hti.Row, hti.Column].ToString() + ' + 你想要显示的内容。'); } else { toolTip1.SetToolTip(c1FlexGrid1, ''); } }运行截图:
标准的 ToolTip 控件可以显示简单的文本提示,如果你需要更为丰富的鼠标提示,你可以使用 C1SuperTooltip 控件,实现将 C1SuperTooltip 添加到窗体中,并在C1SupperTooltip的Images属性中添加一个名 c1_logo.png 的图片,如何在后台代码中添加以下代码: int oldrow = -1; int oldcolumn = -1; private string _tip = @'
![]() |
当前单元格数据:{2}