-- 作者:我爱狐表011
-- 发布时间:2013/4/17 18:21:00
--
我的drawcell的代码为:
\'Return Dim ArrText() As String = e.Text.Split(Chr(11)) Dim Dt As Date Date.TryParse(ArrText(0),Dt) Static Fnt As Font = New Font("微软雅黑",9) Static BrhTop As SolidBrush = New SolidBrush(Color.FromArgb(218, 229, 243)) Static BrhTopText As SolidBrush = New SolidBrush(Color.FromArgb(85,85,85)) \'绘制标题部分 If Dt = Date.Today Then e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(233,184,94)),New Rectangle(e.X,e.Y,e.Width,21)) Else e.Graphics.FillRectangle(BrhTop,New Rectangle(e.X,e.Y,e.Width,21)) End If e.Graphics.DrawString(Dt.Day & "日",Fnt,BrhTopText ,e.X + 20,e.Y + 2) \'绘制农历日期 Dim StrDate As String = Functions.Execute("LunarStr",Dt) If StrDate.Length = 4 Then e.Graphics.DrawString( StrDate ,Fnt,BrhTopText ,e.X + e.Width - 56, e.Y + 2) Else e.Graphics.DrawString( StrDate ,Fnt,BrhTopText ,e.X + e.Width - 68, e.Y + 2) End If \'绘制主体部分颜色 If Dt = Date.Today Then e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(249,234,207)),New Rectangle(e.X,e.Y + 21,e.Width,e.Height - 21)) End If If Not e.Text.Contains(CurrentMonth) Then e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(229,229,229)),New Rectangle(e.X,e.Y + 21,e.Width,e.Height - 21)) End If
If e.Col.Name = "星期四" And e.Row.Index = 2 Then Static BrhTopRect As System.Drawing.Drawing2D.LinearGradientBrush = _ New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(0,18), Color.FromArgb(228, 237, 246), Color.FromArgb(207, 221, 239)) e.Graphics.DrawRectangle(New Pen(Color.FromArgb(144, 171, 205)), e.X + 1, e.Y + 23, e.Width - 4, 19) e.Graphics.FillRectangle(BrhTopRect , e.X + 2, e.Y + 24, e.Width - 5, 18) e.Graphics.DrawString("12:30 Test1",Fnt,Brushes.Black,e.X + 4, e.Y + 25) e.Graphics.DrawRectangle(New Pen(Color.FromArgb(144, 171, 205)), e.X + 1, e.Y + 44, e.Width - 4, 19) e.Graphics.FillRectangle(BrhTopRect , e.X + 2, e.Y + 45, e.Width - 5, 18) e.Graphics.DrawString("12:30 Test",Fnt,Brushes.Black,e.X + 4, e.Y + 46) e.Graphics.DrawRectangle(New Pen(Color.FromArgb(144, 171, 205)), e.X + 1, e.Y + 65, e.Width - 4, 19) e.Graphics.FillRectangle(BrhTopRect , e.X + 2, e.Y + 66, e.Width - 5, 18) e.Graphics.DrawString("12:30 Test",Fnt,Brushes.Black,e.X + 4, e.Y + 67) End If
e.Text = ""
|