Advertisement
perjespersson

Datagrid

Nov 5th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
  2. dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
  3. dataGridView1.ColumnHeadersDefaultCellStyle.Padding = new Padding(0, 7, 0, 7);
  4. dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
  5. dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  6.  
  7. dataGridView1.BackgroundColor = Color.White;
  8. dataGridView1.AllowUserToAddRows = false;
  9. dataGridView1.BorderStyle = BorderStyle.None;
  10. dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None;
  11. dataGridView1.RowHeadersVisible = false;
  12. dataGridView1.ScrollBars = ScrollBars.Vertical;
  13. dataGridView1.AllowUserToResizeColumns = false;
  14. dataGridView1.AllowUserToResizeRows = false;
  15. dataGridView1.AllowUserToDeleteRows = true;
  16. dataGridView1.GridColor = SystemColors.Control;
  17. dataGridView1.EnableHeadersVisualStyles = false;
  18. dataGridView1.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  19. dataGridView1.RowsDefaultCellStyle.BackColor = Color.White;
  20. dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = SystemColors.Menu;
  21. dataGridView1.RowTemplate.Height = 30;
  22. dataGridView1.RowTemplate.ReadOnly = true;
  23. dataGridView1.RowsDefaultCellStyle.SelectionBackColor = SystemColors.ScrollBar;
  24. dataGridView1.RowsDefaultCellStyle.SelectionForeColor = Color.Black;
  25.  
  26. dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
  27.  
  28. foreach (DataGridViewColumn col in dataGridView1.Columns)
  29. {
  30. col.SortMode = DataGridViewColumnSortMode.NotSortable;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement