タイトル : Re: Datagridview の BackColor について 投稿日 : 2008/01/24(Thu) 11:14 投稿者 : AS400からVBへ
魔界の仮面弁士さん ありがとうございます。 これでできそうですが、1つのセルごとのイベントですので、 行単位(ROW)で色付けする方法はございますでしょうか? <データ> NO 日付 品名 1 2008/01/23 パソコン 2 2008/01/22 キーボード <条件> 日付が2008/01/23と等しいデータの行 DataGridView1.Rows(RowIndex).DefaultCellStyle.BackColor の値を指定 Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As _ DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting Dim c As Color = Me.DataGridView1.RowsDefaultCellStyle.BackColor If e.ColumnIndex = 1 And e.Value < Format(Now, "yyyy/MM/dd") Then c = Color.Cyan Me.DataGridView1.Rows(e.RowIndex).DefaultCellStyle.BackColor = c End If End Sub 上記方法より、よいプログラミングがありましたら お手すきの時に教えて頂けると助かります。 |