Foxtable(狐表)用户栏目专家坐堂 → [求助] 执行长代码


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

主题:[求助] 执行长代码

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


加好友 发短信
等级:七尾狐 帖子:1654 积分:14713 威望:0 精华:0 注册:2014/6/6 8:42:00
[求助] 执行长代码  发帖心情 Post By:2018/12/22 9:57:00 [显示全部帖子]

老师,是否可以将一段代码定义为字符串,然后去执行。如果可以改如何处理?谢谢!

        rt1.Cells(t1+tt1+45,0).SpanCols = 10
        rt1.Cells(t1+tt1+45,0).Text = "神经系统常规检查"
        rt1.Rows(t1+tt1+45).Height = 9
        rt1.Rows(t1+tt1+45).Style.BackColor = Color.OliveDrab
        rt1.Cells(t1+tt1+45,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt1.Cells(t1+tt1+45,0).Style.TextAlignVert = prt.AlignVertEnum.Center
        rt1.Cells(t1+tt1+45,0).Style.Font = New Font("宋体", 12, FontStyle.Bold)
        rt1.Rows(t1+tt1+45).Style.GridLines.top = New Prt.LineDef(0.1, Color.Gray)

    Dim s9 As String 
    s9 = " rt1.Cells(t1+tt1+45,0).SpanCols" & " = " & "10" & _
        "rt1.Cells(t1+tt1+45,0).Text" & " = " & "神经系统常规检查" & _
        "rt1.Rows(t1+tt1+45).Height" & " = " & "9" & _
        "rt1.Rows(t1+tt1+45).Style.BackColor = Color.OliveDrab " & _
        "rt1.Cells(t1+tt1+45,0).Style.TextAlignHorz = prt.AlignHorzEnum.Center " & _
        "rt1.Cells(t1+tt1+45,0).Style.TextAlignVert = prt.AlignVertEnum.Center" & _
        "rt1.Cells(t1+tt1+45,0).Style.Font" & " = " & "New Font( " & "宋体" & "," & " 12, FontStyle.Bold) " & _
        "rt1.Rows(t1+tt1+45).Style.GridLines.top" & " = " & "New Prt.LineDef(" & "_0.1" & "," & " Color.Gray" & ")" 
    If s.Contains("神经系统常规") Then
       s9  ‘ 执行上面的那段代码,这里改如何写代码
    end if

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


加好友 发短信
等级:七尾狐 帖子:1654 积分:14713 威望:0 精华:0 注册:2014/6/6 8:42:00
  发帖心情 Post By:2018/12/23 8:42:00 [显示全部帖子]

老师,我有如下一段代码,通过调用  sjxt2 将其还原 。水平有限,请指教。谢谢!

在命令窗口执行   output.Show(Functions.Execute("sjxt2"))  显示已经还原,还原后的代码没有在该处执行。
函数 sjxt2
函数代码:
Dim Code As String 
Code = "rt1.Cells(t1+tt1+46,0).SpanCols = 10" & vbcrlf
Code = Code & " Dim ra14 As prt.RenderArea" & vbcrlf
Code = Code & "ra14 = rt1.Cells(t1+tt1+46,0).Area" & vbcrlf
Code = Code & "Dim rx19 As New prt.RenderText" & vbcrlf
Code = Code & "rx19.Text = ""意识和精神状态:""" & vbcrlf
Code = Code & "rx19.Style.Font" & " =" & " New Font(" & """宋体""" & "," & " 12," & " FontStyle.Bold" & ")" & vbcrlf
Code = Code & "rx19.x = ""0""" & vbcrlf
Code = Code & "rx19.y = ""2""" & vbcrlf
Code = Code & "ra14.Children.Add(rx19)" & vbcrlf
Code = Code & "Dim rx20 As New prt.RenderText" & vbcrlf
Code = Code & "rx20.Text" & " = " & "r(" & """神经系统_意识和精神状态""" & ")" & vbcrlf
Code = Code & "rx20.x = ""35""" & vbcrlf
Code = Code & "rx20.y = ""2""" & vbcrlf
Code = Code & "ra14.Children.Add(rx20)"
Return Code


还原成下面的代码,并且在该位置继续执行代码:
rt1.Cells(t1+tt1+46,0).SpanCols = 10
 Dim ra14 As prt.RenderArea
ra14 = rt1.Cells(t1+tt1+46,0).Area
Dim rx19 As New prt.RenderText
rx19.Text = "意识和精神状态:"
rx19.Style.Font = New Font("宋体", 12, FontStyle.Bold)
rx19.x = "0"
rx19.y = "2"
ra14.Children.Add(rx19)
Dim rx20 As New prt.RenderText
rx20.Text = r("神经系统_浅感觉")
rx20.x = "35"
rx20.y = "2"
ra14.Children.Add(rx20)

[此贴子已经被作者于2018/12/23 9:13:59编辑过]

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


加好友 发短信
等级:七尾狐 帖子:1654 积分:14713 威望:0 精华:0 注册:2014/6/6 8:42:00
  发帖心情 Post By:2018/12/25 12:49:00 [显示全部帖子]

老师,感觉看不懂。能否解释一下。谢谢!

 回到顶部