Setting ToolTip for DataGridView automatically created columns

后端 未结 2 1639
时光说笑
时光说笑 2020-12-22 08:18

I would like to programatically set tooltips to automatically generated columns in a DataGridView. I was trying to use AutoGeneratingColumn event (

2条回答
  •  既然无缘
    2020-12-22 08:56

    tooltiptext for specific cell:

    DataGridView1.Rows[3].Cells["colnameX"].ToolTipText = " hover and see me";
    

    adding tooltip to dynamically added rows specific cell

    private void DataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
    {
        for (int index = e.RowIndex; index <= e.RowIndex + e.RowCount - 1; index++)                           
        {
            DataGridViewRow row = DataGridView1.Rows[index];
            row.Cells["colnameX"].ToolTipText = " hover and see me";
    
        }
    }
    

提交回复
热议问题