当鼠标运行到单元格时,出现气泡,并且气泡朝上。

如图:

winform datagridview tooptip 设置气泡方向朝上。

 关键函数是:tooltip中的函数SetToolTip。

代码如下:

 

 1    private void dgv1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
 2         {
 3             if (e.RowIndex < 0 || e.ColumnIndex < 0)
 4             {
 5                 return;
 6             }
 7            
 8             this.toolTip1.Hide(this.dgv1);
 9 
10             this.CellColumnIndex = e.ColumnIndex;
11             this.CellRowIndex = e.RowIndex;
12             if (this.CellColumnIndex >= 0 && this.CellRowIndex >= 0)
13             {
14                 DataGridViewCell dgvc = this.dgv1[this.CellColumnIndex, this.CellRowIndex];
15                  Rectangle rec = dgvc.ContentBounds;
16                 string tip = "Tip is " + dgvc.Value.ToString();
17                 this.toolTip1.SetToolTip(dgv1, tip);
18 
19             }
20              
21         }

相关文章:

  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2021-12-08
  • 2021-05-21
  • 2022-12-23
猜你喜欢
  • 2021-07-26
  • 2021-09-17
  • 2021-09-22
  • 2021-09-04
  • 2022-01-02
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案