drawcell事件改为:
If DrawGannt Then If e.Row.Index >= 0 Then Dim r As Row = Tables("项目管理.项目任务").Rows(e.Row.Index) Dim str1 As String = r("开始日期") Dim str2 As String = r("结束日期") Dim dt1 As Date Dim dt2 As Date If Date.TryParse(str1, dt1) AndAlso Date.TryParse(str2, dt2) Then Dim dta As Date = e.Col.Name.Replace("年", "-").Replace("月_", "-") If dta >= dt1 AndAlso dta <= dt2 Then e.StartDraw() If dta < Date.Today Then e.Graphics.FillRectangle(Brushes.Green, e.x , e.y + 3, e.Width, e.Height - 7) Else e.Graphics.FillRectangle(Brushes.Red, e.x , e.y + 3, e.Width, e.Height - 7) End If e.EndDraw() End If End If End If End If
|