If e.Row.IsNull(e.Col.Name) = False Then e.StartDraw() Dim cval As String = e.Row(e.Col.Name) e.text = "" Dim arr() As String = cval.Split(",") Dim lst As new List(of String) Dim g As Graphics = e.Graphics Dim fnt = New Font("微软雅黑", e.Table.Font.Size) For Each s As String In arr Dim h As String = IIF(s.Contains("(已)"),"$$",IIF(s.Contains("(未)"),"@$","")) s = s.Replace("(已)", "").Replace("(未)", "") Dim w1 As Integer = g.MeasureString(s, e.Table.Font).Width If w1 > e.Width Dim k1 As Integer = Math.Floor(s.Length * ( e.Width / w1)) Dim i2 As Integer = 0 Do While i2 < s.Length Dim s2 As String = "" If i2+k1<s.Length-1 s2 = s.SubString(i2,k1) Else s2 = s.SubString(i2) End If i2 = i2+k1 lst.Add(h & s2) Exit For Loop Else lst.Add(h & s) End If Next Dim x As Integer = e.x + 1 Dim y As Integer = e.Y + 1 Dim idx As Integer = 0 Dim h1 As Integer = g.MeasureString("A", e.Table.Font).Height For Each s As String In lst If y + h1 > e.y + 1 + e.height Then '超过行高 Else If s.StartsWith("$$") Then g.DrawString(s.SubString(2), e.Table.Font, Brushes.Gray, e.x, y) ElseIf s.StartsWith("@$") Then g.DrawString(s.SubString(2), e.Table.Font, Brushes.Blue, e.x, y) Else g.DrawString(s, e.Table.Font, Brushes.Black, e.x, y) End If End If y = y + h1 + 1 Next End If
|