NOTE If you have just set the datasource of a datatableview any styling you apply to cells may get ignored. You need to set your styling in (or wait for) dataGridView1_DataBindingComplete() instead. Styling cells //******************************************************** //******************************************************** //********** DATAGRIDVIEW DATA BINDING COMPLETE ********** //******************************************************** //******************************************************** private: System::Void dataGridView1_DataBindingComplete(System::Object^ sender, System::Windows::Forms::DataGridViewBindingCompleteEventArgs^ e) { int RowIndex; try { //—————————————————— //—– […]
Category: Styling
Styling Header Cells
Set header cell colour This needs EnableHeadersVisualStyles=false to work dataGridView1->Columns[0]->HeaderCell->Style->BackColor = System::Drawing::Color::Orange;
Styling Columns
Make columns invisible dataGridView1->Columns[0]->Visible = false; Set column width dataGridView1->Columns[ColumnIndex]->Width = 100;