문제

How to add comment to cell in DataGridView? I need to comment my values in the grid.

How to add comment to cell in DataGridView? I need to comment my values in grid

도움이 되었습니까?

해결책

set ToolTipText property on either DataGridViewCell or DataGridViewColumn to whatever text you want.

다른 팁

Each cell can have a tooltip by setting the .ToolTipText property of that cell. Something like this:

// 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";
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top