winforms工具提示在winforms DataGridViewImageColumn [英] winforms Tooltip in winforms DataGridViewImageColumn
本文介绍了winforms工具提示在winforms DataGridViewImageColumn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码根据其绑定的DataProperty在其列中成功显示一个图像:
I have the following code that successfully displays an image in its column based on its bound DataProperty:
private void dgvTasks_CellFormatting( object sender, DataGridViewCellFormattingEventArgs e ) {
if (dgvTasks.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.ColumnIndex == 1) {
e.Value = ( (bool)e.Value == true ) ? Properties.Resources.ok : Properties.Resources.clock;
}
}
但我想知道如何显示一个用户徘徊在图像上的工具提示?
but I would like to know how its possible to show a tooltip when a user hovers over the image?
推荐答案
一般来说,如果你有行&列可以使用以下方式设置ToolTipText:
generally if you have row & column for a cell, you can set a ToolTipText using:
dataGridView1.Rows[rowIndex].Cells[columnIndex].ToolTipText = "..."
在你的情况下,你有e.RowIndex和e.RowIndex: / p>
and in your case, you have e.RowIndex and e.RowIndex:
dgvTasks.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = "..."
这篇关于winforms工具提示在winforms DataGridViewImageColumn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文