If DrawGannt Then
Dim r As Row = Tables("任务_Table1").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()
If dt < Date.Today Then
e.Graphics.FillRectangle(Brushes.Green,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
If r.IsNull("计划任务") = False Then
Dim tp As TimeSpan
Dim dr As Date
tp = dr("开始日期") - dr("结束日期")
Dim day As Double = tp.TotalDays() / r("计划任务") * r("累计完成")
If dt <= dt1.AddHours(24 * day) Then
Dim d As Integer = math.Floor(day)
If (dt-dt1).Days < d Then '满格
e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, e.Width, e.Height - 16)
Else
Dim width As Integer = (day - d) * e.width
e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 8, width, e.Height - 16)
End If
End If
End If
e.EndDraw()
End If
End If