drawcell事件划的表格,还能加背景颜色吗?
Tables("定单明细_table1").Cols("齿位").Width = 400
Tables("定单明细_table1").DefaultRowHeight = 40
e.Text = ""
e.StartDraw()
e.Graphics.DrawLine(pens.black, e.X, CSng(e.y + e.Height / 2), e.X + e.Width, CSng(e.y + e.Height / 2))
e.Graphics.DrawLine(pens.black, CSng(e.X + e.Width / 2), e.y, CSng(e.X + e.Width / 2), e.y + e.Height)
If e.Row.IsNull("齿位") = False Then
Dim sr() As String = e.Row("齿位").Split(":")
Dim size As Object
size = e.Graphics.MeasureString(sr(0), e.Table.Font, e.Width)
e.Graphics.DrawString(sr(0), e.Table.Font, Brushes.Black, CSng(e.X + e.Width / 2) - size.Width - 1, e.Y + 1)
' If sr.Length > 1 Then
e.Graphics.DrawString(sr(1), e.Table.Font, Brushes.Black, CSng(e.X + e.Width / 2) + 1, e.Y + 1)
'e.Graphics.DrawString(sr(1), e.Table.Font, Brushes.Black, CSng(e.X + a) + 1, e.Y + 1)
' End If
' If sr.Length > 1 Then
size = e.Graphics.MeasureString(sr(2), e.Table.Font, e.Width)
e.Graphics.DrawString(sr(2), e.Table.Font, Brushes.Black, CSng(e.X + e.Width / 2) - size.Width - 1, CSng(e.y + e.Height / 2) + 1)
' End If
' If sr.Length > 1 Then
e.Graphics.DrawString(sr(3), e.Table.Font, Brushes.Black, CSng(e.X + e.Width / 2) + 1, CSng(e.y + e.Height / 2) + 1)
' End If
End If
e.EndDraw()
此主题相关图片如下:5.png