C# DataGridView显示悬浮信息
文章目录
最近项目中发现表格中悬浮信息显示不全,后边的内容变成...
通过重写DataGridView的OnCellMouseEnter事件来实现完全显示
protected override void OnCellMouseEnter(DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0 || this.Rows.Count <= 0)
{
}
else
{
this.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = (this.Rows[e.RowIndex].Cells[e.ColumnIndex].Value ?? string.Empty).ToString();
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论