Foxtable(狐表)用户栏目专家坐堂 → [求助]DrawCell无法按指定条件绘制指定单元格


  共有4018人关注过本帖树形打印复制链接

主题:[求助]DrawCell无法按指定条件绘制指定单元格

帅哥哟,离线,有人找我吗?
klg1011
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:320 积分:2798 威望:0 精华:0 注册:2013/1/30 17:49:00
[求助]DrawCell无法按指定条件绘制指定单元格  发帖心情 Post By:2015/3/20 14:43:00 [只看该作者]

我想实现根据单元格不同内容,绘制不同的图片。结果只能绘制一种图片。
以下内容为程序代码:

1 Select Case e.Col.Name
2 Case "设计","采购","生产","组装","调试","发货","现场"
3 For Each dr As Row In e.Table.Rows
4 Dim Names As String() = {"设计","采购","生产","组装","调试","发货","现场"}
5 For Each Name As String In Names
6 If dr(name) = "正常完成" Then
7 e.Text = ""
8 e.StartDraw
9 e.Graphics.DrawImage(zcwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
10 e.EndDraw
11 End If
12 If dr(name) = "延期完成" Then
13 e.Text = ""
14 e.StartDraw
15 e.Graphics.DrawImage(yqwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
16 e.EndDraw
17 End If
18 Next
19 Next
20 End Select

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20150320143813.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/3/20 14:48:00 [只看该作者]

Select Case e.Col.Name
    Case "设计","采购","生产","组装","调试","发货","现场"
        If e.Row(e.Col.Name) = "正常完成" Then
            e.Text = ""
            e.StartDraw
            e.Graphics.DrawImage(zcwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
            e.EndDraw
        Else If e.Row(e.Col.Name) = "延期完成" Then
            e.Text = ""
            e.StartDraw
            e.Graphics.DrawImage(yqwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
            e.EndDraw
        End If
   
End Select

 回到顶部
帅哥哟,离线,有人找我吗?
klg1011
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:320 积分:2798 威望:0 精华:0 注册:2013/1/30 17:49:00
  发帖心情 Post By:2015/3/20 15:10:00 [只看该作者]

谢谢甜版!又重新看了看帮助,代码修改后,运行正常!只比甜版的多句判断If e.Row.IsNull(e.Col.Name) = False 。

Select Case e.Col.Name
    Case "设计","采购","生产","组装","调试","发货","现场"
        If e.Row.IsNull(e.Col.Name) = False '且该列已经输入内容
            If e.Row(e.Col.Name) = "无计划" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(wjh, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
            If e.Row(e.Col.Name) = "正常完成" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(zcwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If 
            If e.Row(e.Col.Name) = "正常进行" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(zcjx, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
            If e.Row(e.Col.Name) = "延期未开工" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(yqwkg, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
            If e.Row(e.Col.Name) = "延期未完成" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(yqwwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
            If e.Row(e.Col.Name) = "延期完成" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(yqwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
            If e.Row(e.Col.Name) = "严重延期未开工" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(yzyq1, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
            If e.Row(e.Col.Name) = "严重延期未完成" Then 
                e.Text = ""
                e.StartDraw
                e.Graphics.DrawImage(yzyq2, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                e.EndDraw
            End If
        End If
End Select

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/3/20 15:14:00 [只看该作者]

简写成这样

Select Case e.Col.Name
    Case "设计","采购","生产","组装","调试","发货","现场"
        If e.Row.IsNull(e.Col.Name) = False '且该列已经输入内容
            e.Text = ""
            e.StartDraw
            Select Case e.Row(e.Col.Name)
                Case "无计划"
                    e.Graphics.DrawImage(wjh, e.x+3,e.y+2,e.Width-6, e.Height-4 )
                Case "正常完成"
                    e.Graphics.DrawImage(zcwc, e.x+3,e.y+2,e.Width-6, e.Height-4 )
            End Select
            e.EndDraw
        End If
End Select


 回到顶部
帅哥哟,离线,有人找我吗?
klg1011
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:320 积分:2798 威望:0 精华:0 注册:2013/1/30 17:49:00
  发帖心情 Post By:2015/3/20 15:21:00 [只看该作者]

多谢甜版!!!!图片点击可在新窗口打开查看

 回到顶部