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
|
'cette boucle dure 15s
For i As Integer = 0 To DGV1.RowCount - 1 Step 3 'la première ligne d'une réf est identique à celle des manquants sans confirmation
DGV1.Rows(i).Height = 40
DGV1.Rows(i + 1).Visible = False 'je masque cette ligne, seulement utile à la mise en forme de la ligne "i", inutile de l'afficher dans le dgv.
DGV1.Rows(i + 2).DefaultCellStyle.BackColor = Color.Gray
DGV1.Rows(i + 2).Height = 30
'cette partie dure 12s
For j As Integer = 15 To DGV1.Columns.Count - 1
If DGV1.Rows(i).Cells(j).Value < 0 And DGV1.Rows(i + 1).Cells(j).Value < 0 Then
DGV1.Rows(i).Cells(j).Style.BackColor = Color.OrangeRed
DGV1.Rows(i).Cells(j).Style.ForeColor = Color.White
ElseIf DGV1.Rows(i).Cells(j).Value < 0 And DGV1.Rows(i + 1).Cells(j).Value > 0 Then 'en fonction du contenu de la 2e ligne, on modifie la couleur de ces cellules de la premiere
DGV1.Rows(i).Cells(j).Style.BackColor = Color.OliveDrab
Else
DGV1.Rows(i).Cells(j).Style.BackColor = Color.LightGreen
End If
DGV1.Rows(i + 2).Cells(j).Style.BackColor = Color.White 'coloration de la 3e ligne à partir de la colonne 15
If (DGV1.Rows(i + 2).Cells(j).Value <> "0 / 0") Then
DGV1.Rows(i + 2).Cells(j).Style.ForeColor = Color.Blue
Else
DGV1.Rows(i + 2).Cells(j).Style.ForeColor = Color.Gray
End If
Next
'cette partie dure 3s
For j As Integer = 4 To 13
DGV1.Rows(i + 2).Cells(j).Style.BackColor = Color.Black
DGV1.Rows(i + 2).Cells(j).Style.ForeColor = Color.White
DGV1.Rows(i + 2).Cells(j).Value = "" 'on vide la cellule
DGV1.Rows(i + 2).Cells(j).ReadOnly = True
Next
DGV1.Rows(i + 2).Cells(DGV1.Columns.Count - 1).Value = "" 'je vide le contenu de la dernière cellule de la ligne.
next |
Partager