请老师,帮忙看看,以下代码,能根据不同时间显示颜色了,但是如果实际完成时间大于计划完成时间时,右表的最大时间是计划完成时间,不会延展绘制实际完成时间,
是否要调整内部函数才行? 实际完成时间有两种可能,大于或小于计划完成时间
If DrawGannt Then
Dim r As Row = Tables("投标策划副表时间审批").Rows(e.Row.Index)
Dim dt1 As Date = r("计划开始时间")
Dim dt2 As Date = r("计划完成时间")
Dim dt3 As Date = r("实际完成时间")
Dim dt As Date = e.Col.Name.Replace("年","-").Replace("月_","-")
e.StartDraw()
If dt>=dt1 AndAlso dt<=dt2 Then
e.Graphics.FillRectangle(Brushes.Green,e.x ,e.y + 5, e.Width, e.Height - 10)
End If
If dt< Date.Today Then
If dt>=dt1 AndAlso dt<=dt3 Then 'If dt>dt1 AndAlso dt<=dt3 Then
If dt2>= dt3 Then 'dt2 >=
e.Graphics.FillRectangle(Brushes.DeepSkyBlue,e.x ,e.y + 5, e.Width, e.Height - 10)
Else
If dt>=dt2 AndAlso dt<=dt3 Then 'dt>
If dt>=dt3 Then
e.Graphics.FillRectangle(Brushes.red,e.x ,e.y + 5, e.Width, e.Height - 10)
Else
e.Graphics.FillRectangle(Brushes.red,e.x ,e.y + 5, e.Width, e.Height - 10)
End If
End If
End If
End If
End If
e.EndDraw()
End If