0
如何在DataGridView
中添加单元格注释?我需要在网格中评论我的值。如何将描述添加到DataGridView单元格
如何在DataGridView
中添加单元格注释?我需要在网格中评论我的值。如何将描述添加到DataGridView单元格
设置在任DataGridViewCell
或DataGridViewColumn
任何你想要的文字ToolTipText
财产。
每个小区可以具有通过设置该单元的the .ToolTipText
property的工具提示。事情是这样的:
// Event for formatting cells when rendering the grid
void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// Some logic for determining which cell this is in the row
if ((e.ColumnIndex == this.dataGridView1.Columns["SomeColumn"].Index))
{
// Get a reference to the cell
DataGridViewCell cell = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
// Set the tooltip text
cell.ToolTipText = "some text";
}
}