以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  这样做出来单元格,能加背景色吗?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=193496)

--  作者:xxfoxtable
--  发布时间:2024/9/20 0:30:00
--  这样做出来单元格,能加背景色吗?
   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
图片点击可在新窗口打开查看


--  作者:有点蓝
--  发布时间:2024/9/20 8:42:00
--  
先画背景再画线:http://www.foxtable.com/webhelp/topics/1482.htm


e.StartDraw()
e.Graphics.FillPolygon(Brushes.Green,......
    e.Graphics.DrawLine(pens.black, ....