16,554
社区成员
发帖
与我相关
我的任务
分享
Private Sub DataGridView1_RowPrePaint(ByVal sender As Object, _
ByVal e As DataGridViewRowPrePaintEventArgs) _
Handles DataGridView1.RowPrePaint
'背景を描画するか
If (e.PaintParts And DataGridViewPaintParts.Background) = _
DataGridViewPaintParts.Background Then
'選択されているか調べ、色を決定する
'bColor1が開始色、bColor2が終了色
Dim bColor1, bColor2 As System.Drawing.Color
If (e.PaintParts And DataGridViewPaintParts.SelectionBackground) = _
DataGridViewPaintParts.SelectionBackground AndAlso _
(e.State And DataGridViewElementStates.Selected) = _
DataGridViewElementStates.Selected Then
bColor1 = e.InheritedRowStyle.SelectionBackColor
bColor2 = System.Drawing.Color.Black
Else
bColor1 = e.InheritedRowStyle.BackColor
bColor2 = System.Drawing.Color.YellowGreen
End If
‘还有一些代码
End If
End Sub