Search code examples
winformsdatagridviewc++-cliclr

How to change the height of an individual cell in a datagridview?


I would like to know how you would change the height of a cell without affecting the whole row. I'm making a timetable form and I need to change the height of a cell depending on the amount of time the event takes.

I'm making this in a clr project and using C++


Solution

  • dataGridView1->Rows[0]->Cells[0]->Style->BackColor = Color::Red;

    sets the background colour of the first cell on the first row to red.

    Change dataGridView1 to whatever your datagridview is called and set the row and column values as you need them.

    You will probably also have to add: - using namespace System::Drawing;