Foxtable(狐表)用户栏目专家坐堂 → 单元格绘图问题求助?


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

主题:单元格绘图问题求助?

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/14 23:15:00 [显示全部帖子]

drawcell事件

 

If e.Table.name = "窗口1_table2" Then
    If e.Col.name Like "*户型" AndAlso e.text > "" Then
        e.StartDraw()
        Dim cs() As Char = {"栋","幢", "-", "#", "/"}
        Dim fnt As New Font("宋体",9)
        Dim drs As List(Of DataRow) = DataTables("表C").Select("小区地址 = '" & e.Row("小区地址") & "'")
        For Each dr As DataRow In drs
            If dr("楼号").split(cs)(0) & "幢" = e.Row("小区楼号") AndAlso dr("楼号") Like "*" & e.text & "*" Then
                e.text = ""
                Dim msg As String = dr("消售情况")
                e.Graphics.DrawString(msg,fnt,Brushes.Red,e.x+1, e.y+1)
                Exit For
            End If
        Next
        e.EndDraw()
       
    End If
End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/14 23:45:00 [显示全部帖子]

If e.Table.name = "窗口1_table2" Then
    If e.Col.name Like "*户型" AndAlso e.text > "" Then
        Dim cs() As Char = {"栋","幢", "-", "#", "/"}
        Dim fnt As New Font("宋体",9)
        Dim drs As List(Of DataRow) = DataTables("表C").Select("小区地址 = '" & e.Row("小区地址") & "'")
        For Each dr As DataRow In drs
            If dr("楼号").split(cs)(0) & "幢" = e.Row("小区楼号") AndAlso dr("楼号") Like "*" & e.text & "*" Then
                e.style = dr("消售情况")
                Exit For
            End If
        Next
    End If
End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/15 9:51:00 [显示全部帖子]

代码要改一下

 

If e.Table.name = "窗口1_table2" Then
    If e.Col.name Like "*户型" AndAlso e.text > "" Then
        e.StartDraw()
        Dim cs() As Char = {"栋","幢", "-", "#", "/"}
        Dim fnt As New Font("宋体",9)
        Dim drs As List(Of DataRow) = DataTables("表C").Select("小区地址 = '" & e.Row("小区地址") & "'")
        For Each dr As DataRow In drs
            Dim ary() As String = dr("楼号").split(cs)
            If ary.length = 2 Then
                If ary(0) & "幢" = e.Row("小区楼号") AndAlso ary(1).length >= e.text.length AndAlso ary(1).Substring(0, e.text.length) = e.text Then
                    e.style = dr("消售情况")
                    Exit For
                End If
            End If
        Next
        e.EndDraw()
       
    End If
End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/15 10:15:00 [显示全部帖子]

认认真真看13楼啊。

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/15 10:19:00 [显示全部帖子]

        Dim ary() As String = dr("楼号").split(cs)
            If ary.length = 2 Then
                If ary(0) & "幢" = e.Row("小区楼号") AndAlso ary(1).length >= e.text.length AndAlso ary(1).Substring(0, e.text.length) = e.text Then

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/15 20:02:00 [显示全部帖子]

汗,那你就这样测试,就例子我测试没问题

 

If e.Table.name = "窗口1_table2" Then
    If e.Col.name Like "*户型" AndAlso e.text > "" Then
        e.StartDraw()
        Dim cs() As Char = {"栋","幢", "-", "#", "/"}
        Dim fnt As New Font("宋体",9)
        Dim drs As List(Of DataRow) = DataTables("表C").Select("小区地址 = '" & e.Row("小区地址") & "'")
        For Each dr As DataRow In drs
            Dim ary() As String = dr("楼号").split(cs)
            If ary.length = 2 Then
                If ary(0) & "幢" = e.Row("小区楼号") AndAlso ary(1).length >= e.text.length AndAlso ary(1).Substring(0, e.text.length) = e.text Then
                    e.text = ""
                    Dim msg As String = dr("消售情况")
                    e.Graphics.DrawString(msg,fnt,Brushes.Red,e.x+1, e.y+1)
                    Exit For
                End If
            End If
        Next
        e.EndDraw()
       
    End If
End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/15 20:51:00 [显示全部帖子]

看懂21楼啊。和13楼的也一样啊,你设置好对应的样式,就没问题。

[此贴子已经被作者于2016/3/15 20:51:27编辑过]

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/15 22:39:00 [显示全部帖子]

哦,多写了两句代码

 

If e.Table.name = "窗口1_table2" Then
    If e.Col.name Like "*户型" AndAlso e.text > "" Then
        Dim cs() As Char = {"栋","幢", "-", "#", "/"}
        Dim fnt As New Font("宋体",9)
        Dim drs As List(Of DataRow) = DataTables("表C").Select("小区地址 = '" & e.Row("小区地址") & "'")
        For Each dr As DataRow In drs
            Dim ary() As String = dr("楼号").split(cs)
            If ary.length = 2 Then
                If ary(0) & "幢" = e.Row("小区楼号") AndAlso ary(1).length >= e.text.length AndAlso ary(1).Substring(0, e.text.length) = e.text Then
                    e.style = dr("消售情况")
                    Exit For
                End If
            End If
        Next
    End If
End If


 回到顶部