以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  一句代码怎么会有两张图  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=106155)

--  作者:漂亮美眉vszh
--  发布时间:2017/9/3 16:36:00
--  一句代码怎么会有两张图

老师,我这一句代码画一条线,一共画了两条线,可是在窗口上显示时,怎么会有四条线?即两副图

 


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

--  作者:漂亮美眉vszh
--  发布时间:2017/9/3 16:36:00
--  
  Dim i As Integer = r("动力得分合计") / (r("动力得分合计") + r("阻力得分合计")) *1000
            Dim i1 As Integer = r("阻力得分合计") / (r("动力得分合计") + r("阻力得分合计")) *1000
            Dim p As WinForm.Painter = e.Form.Controls("Painter1")
            Dim g As Graphics = p.Graphics
            Dim n As New Pen(Color.green,5)
            g.DrawLine(N,100,100,i,100)
            Dim fnt As New Font("宋体",16)
            Dim msg As String = "动力"
            g.DrawString(msg,fnt,Brushes.green,50,90)
            p.Repaint()
           
            Dim p1 As WinForm.Painter = e.Form.Controls("Painter1")
            Dim g1 As Graphics = p1.Graphics
            Dim n1 As New Pen(Color.red,5)
            g1.DrawLine(N1,100,200,i1,200)
            Dim fnt1 As New Font("宋体",16)
            Dim msg1 As String = "阻力"
            g1.DrawString(msg1,fnt1,Brushes.red,50,190)
            p1.Repaint()

--  作者:有点甜
--  发布时间:2017/9/3 16:56:00
--  

绘画之前,要先把Painter的宽高设置成最大,然后绘画,然后设置回适合你页面的大小。

 

如代码

 

Dim p As WinForm.Painter = e.Form.Controls("Painter1")
p.dock = 0
p.width = 10000

Dim g As Graphics = p.Graphics
g.DrawLine(Pens.Red,30,0,30,60)
g.DrawLine(Pens.Red,0,30,60,30)
p.Repaint()