If DrawGannt Then
Dim r As Row = Tables("任务").Rows(e.Row.Index)
Dim dt1 As Date = r("开始日期")
Dim dt2 As Date = r("结束日期")
Dim dt As Date = e.Col.Name.Replace("年", "-").Replace("月_", "-")
If dt >= dt1 AndAlso dt <= dt2 Then
e.StartDraw()
Dim Sum2 As Double = DataTables("工序跟踪表").Compute("Sum(合格品)", "生产批次 = '“ & r("生产批次") & ”'")
Dim bh As Brush
If Sum2 > 0 Then
bh = Brushes.Green
Else
bh = Brushes.yellow
End If
If dt < Date.Today Then
e.Graphics.FillRectangle(bh, e.x , e.y + 5, e.Width, e.Height - 10)
Else
e.Graphics.FillRectangle(Brushes.Red, e.x , e.y + 3, e.Width, e.Height - 7)
End If
e.EndDraw()
End If
End If