25 Ağustos 2008 Pazartesi

DataGridView Satırlarını Renklendirme

DataGridView'in RowPrePaint Eventine aşağıdaki kodları yazalım...

Private

Sub DataGridView1_RowPrePaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPrePaintEventArgs) Handles

DataGridView1.RowPrePaint

Dim satir As DataGridViewRow = Me.DataGridView1.Rows(e.RowIndex)

Dim sayi As Integer

sayi = Val(e.RowIndex) Mod 2

If sayi = 0 Then

satir.DefaultCellStyle.BackColor = Color.Beige

Else

satir.DefaultCellStyle.BackColor = Color.Azure

End If

End Sub

Etiketler: , , ,

0 Yorum:

Yorum Gönder

Kaydol: Kayıt Yorumları [Atom]

<< Ana Sayfa