1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
//Taille DGV
unDGV_Saisie.Width = 433;
unDGV_Saisie.Height = 350;
//style colonne
unDGV_Saisie.ColumnHeadersDefaultCellStyle.Font = new Font(unDGV_Saisie.Font, FontStyle.Bold);
unDGV_Saisie.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
unDGV_Saisie.CellBorderStyle = DataGridViewCellBorderStyle.Single;
// modifier les colonnes et les lignes
monDGV.AllowUserToResizeColumns = false;
monDGV.AllowUserToResizeRows = false;
// couleur de fond
monDGV.BackgroundColor = Color.White;
// affichage des en-tête de colonnes
monDGV.ColumnHeadersVisible = true;
monDGV.Columns[0].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
monDGV.Columns[1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
monDGV.Columns[2].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
monDGV.Columns[3].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
monDGV.Columns[4].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
monDGV.Columns[5].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
// couleur des séparations
monDGV.GridColor = Color.Chocolate;
// interdire les modifs des cellules
if (monDGV.Name == "unDGV_Saisie")
{ monDGV.ReadOnly = false; }
else { monDGV.ReadOnly = true; }
// affichage des en-tête de ligne
monDGV.RowHeadersVisible = true;
// mode de selection des cellules
monDGV.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
monDGV.MultiSelect = false;
// style des cellules
monDGV.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter;
monDGV.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter;
monDGV.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomLeft;
monDGV.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight;
monDGV.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomRight;
monDGV.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.BottomCenter;
//monDGV.ClearSelection();
//monDGV.Rows[0].Selected = false;
monDGV.CurrentCell = monDGV.Rows[0].Cells[0];
monDGV.Rows[0].Selected = false; |
Partager