private void dataGridView2_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if ((e.ColumnIndex == this.dataGridView2.Columns["txtCom"].Index)
&& e.Value != null)
{
DataGridViewCell cell = this.dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex];
cell.ToolTipText = "ksdjfdkfaksd";
}
}
本文介绍了一个在DataGridView中为特定单元格设置ToolTipText的方法。通过监听CellFormatting事件,可以在指定列的每个单元格显示提示信息,增强了表格数据显示的灵活性。

被折叠的 条评论
为什么被折叠?



