以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于单元格绘制与逻辑列联动的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80383) |
-- 作者:douglas738888 -- 发布时间:2016/1/21 16:21:00 -- 关于单元格绘制与逻辑列联动的问题 大红袍老师,我参照论坛中的例子尝试做了个单元格绘制,想实现表A中审核逻辑列未勾选的时候,审核通过列全部显示自动绘制的“未审核”(红色),但审核逻辑列勾选后,自动绘制的“已审核”(蓝色)出现,“未审核”(红色)标签关闭。不知道在这里的IF......应该怎样写来控制自动的想法。 绘制的单元格是否只能实现手动输入文字后才能实现显示绘制, 如果用If..... e.Style =...绘制成逻辑列单元格根据条件的色块变化这个自己会做了。 但是上述的自动形式怎样能实现,还是用绘制就不能实现。
下面是初步的代码,没有实现逻辑列控制 If e.Col.Name = "审核状态" Then e.StartDraw() Dim msg As String Dim tl As Integer = e.Text.Length Select Case tl Case 2 msg = " " & e.Text & " " Case 3 msg = " " & e.Text & " " Case Else msg = e.Text End Select If msg = "" Then Return If tl <= 4 Then e.Col.Width = 61 Else e.Col.width = tl*15+1 End If Dim w As Integer = e.Width - 4 Dim h As Integer = e.Height - 4 Dim x As Integer = e.x + (e.Width - w)/2 Dim n As Pen Dim fnt As New Font("黑体",9) Dim br As Brus If e.Text.Contains("审") Then n = New Pen(Color.Blue,2) br = New SolidBrush(color.Blue) Else n = New Pen(Color.Red,2) br = New SolidBrush(color.red) End If e.Graphics.DrawRectangle(n,x,e.y + 2,w,h) e.Graphics.DrawString(msg,fnt,br,x + 1,e.y + 4) e.Text = "" e.EndDraw() End If |
-- 作者:大红袍 -- 发布时间:2016/1/21 16:28:00 -- If e.Col.Name = "审核状态" Then e.StartDraw() Dim w As Integer = e.Width - 4 Dim h As Integer = e.Height - 4 Dim x As Integer = e.x + (e.Width - w)/2 Dim n As Pen Dim fnt As New Font("黑体",9) Dim br As object Dim msg As String If e.Row("审核") = True Then n = New Pen(Color.Blue,2) br = New SolidBrush(color.Blue) msg = "已审核" Else n = New Pen(Color.Red,2) br = New SolidBrush(color.red) msg = "未审核" End If e.Graphics.DrawRectangle(n,x,e.y + 2,w,h) e.Graphics.DrawString(msg,fnt,br,x + 1,e.y + 4) e.Text = "" e.EndDraw() End If |
-- 作者:douglas738888 -- 发布时间:2016/1/21 16:39:00 -- 非常感谢大红袍老师的指导!!!!!!!!!! |