下面是在.net中的画图代码
Sub DrawPicture()
Dim myTop,myLeft,myTop1,myLeft1,myWidth,myHeight,myWidth1,myHeight1 As Integer
Dim myI,myY As Integer
Dim myRectangle,myRectangle1,myRectangle2 As Rectangle
Dim myGraphics As Graphics
Dim myBitMap as BitMap
Dim myPen As New Pen(Color.Blue, 1)
Dim I,J,K As Integer
Dim myRwidth As Integer
Dim myRJg,myPer1,myPer2 As Integer
Dim myPer,myPer0 As Double
Dim myColor As New ArrayList()
myI=300
myY=400
myWidth=400
MyHeight=400
myLeft=50
myTop=50
myLeft1=40
myTop1=100
myWidth1=10
myColor.Add(New SolidBrush(Color.Red))
myColor.Add(New SolidBrush(Color.teal))
myColor.Add(New SolidBrush(Color.Yellow))
myColor.Add(New SolidBrush(Color.blue))
myColor.Add(New SolidBrush(Color.green))
myColor.Add(New SolidBrush(Color.Cyan))
myColor.Add(New SolidBrush(Color.DarkOliveGreen))
myColor.Add(New SolidBrush(Color.Gold))
myColor.Add(New SolidBrush(Color.Pink))
myColor.Add(New SolidBrush(Color.bisque))
myColor.Add(New SolidBrush(Color.black))
myColor.Add(New SolidBrush(Color.blueviolet))
myColor.Add(New SolidBrush(Color.turquoise))
myColor.Add(New SolidBrush(Color.fuchsia))
myColor.Add(New SolidBrush(Color.darkorchid))
myBitmap=New Bitmap(myWidth+myI+100,myHeight+50) '创建一个Bitmap实例
myGraphics=Graphics.FromImage(myBitMap) '创建一个Graphics实例
myRectangle=new Rectangle(myLeft,myTop,myWidth,myHeight) '创建矩形框
myGraphics.FillRectangle(New SolidBrush(Color.white),0,0,myWidth+myI+100,myHeight+50) '填充矩形
myGraphics.DrawLine(myPen,myLeft,myTop,myLeft,myHeight) '画竖线
myGraphics.DrawLine(myPen,myLeft,myHeight,myWidth+myI,myHeight) '画横线
J=myLeft1
K=myTop
myGraphics.DrawString(myXmNr & " " & myYpMc & " 成本项目阶段(" & myQsny1 & "-" & myQsNy2 & " 与 " & myzzNy1 & "-" & myZzNy2 & "
汇总同期对比表",New Font("宋体",14,FontStyle.bold),New Solidbrush(Color.black),myLeft,myTop-40)
For I=0 To myArrayCbXmStr.GetUpperBound(0)
'myper=myArrayQsFy(I)/800000
'myPer0=myArrayZzFy(I)/800000
myper=myArrayQsFy(I)/myQsTotal*800
myPer0=myArrayZzFy(I)/myZzTotal*800
If myPer>0 Then
If myPer<1 Then
myPer1=1
Else
myPer1=Cint(myPer)
End If
Else
myPer1=0
End If
If myPer0>0 Then
If myPer0<1 Then
myPer2=1
Else
myPer2=Cint(myPer0)
End If
Else
myPer2=0
End If
myRectangle1=New Rectangle(myLeft1+J,myHeight-myPer1,myWidth1,myPer1)
myGraphics.FillRectangle(myColor(I),myLeft1+J,myHeight-myPer1,myWidth1,myPer1) '填充矩形
myRectangle1=New Rectangle(myLeft1+J+mywidth1+1,myHeight-myPer2,myWidth1,myPer2)
myGraphics.FillRectangle(myColor(I),myLeft1+J+mywidth1+1,myHeight-myPer2,myWidth1,myPer2) '填充矩形
J=myLeft1+(I+1)*35
myGraphics.FillRectangle(myColor(I),myWidth+myI-60,myTop+k,10,10)
myGraphics.DrawString(myArrayCbXmStr1(I),New Font("宋体",9,FontStyle.Regular),New Solidbrush(Color.black),myWidth+MyI-40,myTop+K)
K=mytop+(I+1)*15
'If myTotalValue>0 Then
' myGraphics.DrawString(myArrayName(k) & ":" & Format(myArrayValue(k),"##,###0.00"
& "元 占总费用的 " & Format(myArrayvalue(K)/myTotalValue*100,"##0.00"
& "%",New Font("宋体",9,FontStyle.Regular),New Solidbrush(Color.black),myLeft+myWidth+20+20,myTop+10+K*18)
'Else
' myGraphics.DrawString(myArrayName(k) & ":" & Format(myArrayValue(k),"##,###0.00"
& "元 占总费用的 0.00%",New Font("宋体",9,FontStyle.Regular),New Solidbrush(Color.black),myLeft+myWidth+20+20,myTop+10+K*18)
'End If
'myGraphics.DrawString(myArrayName(k),New Font("宋体",10,FontStyle.Regular),New Solidbrush(Color.White),myLeft+myWidth+20+50,myTop+K*20)
Next I
Response.ContentType="Image/jpeg"
myBitMap.Save(response.OutputStream,ImageFormat.Jpeg)
myGraphics.Dispose()
myBitmap.Dispose()
End Sub