以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  绘图引用  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=128893)

--  作者:liuandwang
--  发布时间:2018/12/17 18:33:00
--  绘图引用
我在单元格中直接绘图,使用的是Drawcell事件如下,但在窗口中不能引用图例列中的图片,求助怎样操作才能调用绘制出的图片。

If e.Col.Name = "图例" Then
    Dim g As Graphics = e.Graphics
    Dim pn As New Pen(Color.red,2)
    Dim pn1 As New Pen(Color.LightGray,2)
pn1.DashStyle = DashStyle.DashDotDot
    Dim fnt As New Font("宋体",8,FontStyle.Regular)
    e.StartDraw()
    Dim w,h,ks,kshx,dgc,qthx,qtks,rx,ry,x,y As Single
    h = e.Row("高")
    w = e.Row("宽") \'长方形宽
ks = e.Row("开数")
kshx = e.Row("开数划线")
dgc = e.Row("吊管长") 
qthx = e.Row("气头划线")
qtks = e.Row("气头空数")
    g.DrawRectangle(pn,e.x+35,e.y+15, w/10, h/10) \'绘制长方形
g.DrawString(h,fnt,Brushes.RoyalBlue,w/20+e.x,h/10+19+e.y)
    g.DrawString(w,fnt,Brushes.RoyalBlue,w/10+39+e.x,h/20+e.y)
If qtks >0
    \'绘制角线
    g.DrawLine(pn,e.x+35,e.y+15+dgc/10,e.x+35+w/10,e.y+15+dgc/10)
If qtks > 3 Then
    g.DrawLine(pn,e.x+35+qthx/10,e.y+15,e.x+35+qthx/10,e.y+15+dgc/10)
    g.DrawLine(pn,e.x+35+2*qthx/10,e.y+15,e.x+35+2*qthx/10,e.y+15+dgc/10)
g.DrawLine(pn,e.x+35+3*qthx/10,e.y+15,e.x+35+3*qthx/10,e.y+15+dgc/10)
Else
If qtks > 2
    g.DrawLine(pn,e.x+35+qthx/10,e.y+15,e.x+35+qthx/10,e.y+15+dgc/10)
    g.DrawLine(pn,e.x+35+2*qthx/10,e.y+15,e.x+35+2*qthx/10,e.y+15+dgc/10)
Else
If qtks > 1
    g.DrawLine(pn,e.x+35+qthx/10,e.y+15,e.x+35+qthx/10,e.y+15+dgc/10)
            e.EndDraw()   
End If
End If
End If
End If
End If

--  作者:有点蓝
--  发布时间:2018/12/17 20:16:00
--  
窗口使用绘图板控件,按照同样的方法绘制图片:http://www.foxtable.com/webhelp/scr/1481.htm
--  作者:liuandwang
--  发布时间:2018/12/20 10:49:00
--  
我每次绘制的量达到了近百个图形,原来的想法是在单元格中绘制图形,再通过标签打印的方法对单元格中图形进行引用。老师看看有没有好的方法


--  作者:有点甜
--  发布时间:2018/12/20 10:54:00
--  

不能直接引用的。你需要重新绘制(拷贝代码过来,把 e.x、e.y、e.widht、e.height 的值替换一下即可的,代码基本不变)

 

在绘图板那里绘制之后,你可以把内容保存为图片的的。


--  作者:liuandwang
--  发布时间:2019/1/2 18:11:00
--  
甜老师:
我有一段代码:e.form.controls("TextBox2").text = fdr("出货日期"),是在窗口文本框显示出货日期。
错误所在事件:窗口,平开窗结算单,出货,CheckedChanged
详细错误信息:
没有为 类型“Date” 和 类型“Integer” 定义运算符“=”。
怎么解决,谢谢

--  作者:有点甜
--  发布时间:2019/1/2 18:12:00
--  
不是这段代码导致的错误,请贴出完整代码。以及textbox2的textchanged、valuechanged事件代码。
--  作者:liuandwang
--  发布时间:2019/1/3 16:40:00
--  
外框出货是逻辑按钮,按钮CheckedChanged事件:
Dim ly1 As WinForm.CheckBox = e.Form.Controls("外框出货")
If ly1.Checked = True
    Dim drs1 As List(Of DataRow) = DataTables("订单主表").Select("订单编号 = \'" & e.form.controls("订单编号").Text & "\'")
    If drs1.count > 0 Then
        Dim ddbh As String = e.form.controls("订单编号").Text
        Dim fdr1 As DataRow = DataTables("订单主表").find("订单编号 = \'" & ddbh & "\'")
        fdr1("外框出货") = True
        e.form.controls("TextBox9").Text = drs1(0)("出货配件")
        If fdr1("外框出货日期") = not Nothing
            e.form.controls("TextBox2").text = fdr1("外框出货日期")
        Else
            If ly1.Checked = True
                If fdr1("外框出货日期") = Nothing
                    e.form.controls("TextBox2").value = Date.Today
                Else
                    e.form.controls("TextBox2").Text = Nothing
                    e.form.controls("TextBox9").Text = Nothing
                End If
            End If
        End If
    End If
End If

--  作者:有点甜
--  发布时间:2019/1/3 17:11:00
--  

If fdr1("外框出货日期") = not Nothing

 

改成

 

If fdr1("外框出货日期") <> Nothing