请教老师,以下代码中,如果修改变量xx,yy的值,第一个方框的位置为何不随之变动呢?
代码如下 :
Dim doc As New PrintDoc
Dim rt As New prt.RenderText '设置页眉的文本对象
rt.Text="qwerwqreqwer"
Doc.PageHeader=rt
Dim g As New prt.RenderGraphics()
Dim pn As New Pen(Color.Red,0.1) '画笔
Dim fnt As New Font("宋体",10) '文字字体
Dim points_4cf(4) As Point '四边形
Dim points_4lx(4) As Point ' 菱形
Dim xx,yy As Integer ''四方形左上点坐标
Dim ll,hh As Integer '四方形橫长及纵高
xx=52 '节点图左上点横坐标
yy=152 '节点图左上点纵坐标
ll=80 '四边形横长
hh=30 '四边形纵高
'箭头线条变量
Dim linelength As Integer =30 '线长
Dim linelength1 As Integer =4 '箭头线长
Dim points1(1) As Point '主线条
Dim points11(1) As Point '箭头左半部
Dim points12(1) As Point '箭头右半部
Dim s_name As String
For i As Integer=1 To 10
s_name="wwwwww"
g.Graphics.DrawRectangle(pn,xx,yy,ll,hh) '此处的xx,yy值在上面赋值无效???
'文字
g.Graphics.DrawString(s_name,fnt,Brushes.Red,xx-2,(yy+hh/2)-6)
'竖箭头主线条
points1(0) = New Point(xx+ll/2, yy+hh)
points1(1) = New Point(xx+ll/2,yy+hh+linelength)
g.Graphics.DrawLines(Pens.Green, points1)
'箭头左半部
points11(0) = New Point(xx+ll/2-linelength1,yy+hh+linelength-linelength1)
points11(1) = New Point(xx+ll/2,yy+hh+linelength)
g.Graphics.DrawLines(Pens.Green, points11)
'箭头右半部
points12(0) = New Point(xx+ll/2+linelength1,yy+hh+linelength-linelength1)
points12(1) = New Point(xx+ll/2,yy+hh+linelength)
g.Graphics.DrawLines(Pens.Green, points12)
yy=yy+hh+linelength '下方下一个四边形左上点纵坐标
Next
Doc.Body.Children.Add(g)
Doc.Preview()