I have this code that writes a pie chart in a asp.net page, but I want to
use it in a server control.
When I try I get a error on the last line "Response.Outpu tStream"
Obviously there is no response object but how do I write it to screen?
Dim objBitmap As New System.Drawing. Bitmap(400, 440)
Dim objGraphics As System.Drawing. Graphics
objGraphics = System.Drawing. Graphics.FromIm age(objBitmap)
objGraphics.Cle ar(Drawing.Colo r.White)
Dim p As New Drawing.Pen(Dra wing.Color.Yell ow, 0)
Dim rect As New Drawing.Rectang le(10, 10, 280, 280)
'objGraphics.Dr awEllipse(p, rect)
Dim b1 As New Drawing.SolidBr ush(Drawing.Col or.Red)
Dim b2 As New Drawing.SolidBr ush(Drawing.Col or.Green)
Dim b3 As New Drawing.SolidBr ush(Drawing.Col or.Blue)
objGraphics.Fil lPie(b1, rect, 0.0, 90.0)
objGraphics.Fil lPie(b2, rect, 90.0, 60.0)
objGraphics.Fil lPie(b3, rect, 150.0, 210.0)
Dim fontfml As New
Drawing.FontFam ily(Drawing.Tex t.GenericFontFa milies.Serif)
Dim font As New Drawing.Font(fo ntfml, 14)
Dim brush As New Drawing.SolidBr ush(Drawing.Col or.Black)
objGraphics.Dra wString("Missy Mosley", font, brush, 100, 300)
Dim i As Image = New Image
Dim mStream As MemoryStream = New MemoryStream
Dim httpApp As HttpApplication = New HttpApplication
objBitmap.Save( Response.Output Stream,
Drawing.Imaging .ImageFormat.Gi f)
use it in a server control.
When I try I get a error on the last line "Response.Outpu tStream"
Obviously there is no response object but how do I write it to screen?
Dim objBitmap As New System.Drawing. Bitmap(400, 440)
Dim objGraphics As System.Drawing. Graphics
objGraphics = System.Drawing. Graphics.FromIm age(objBitmap)
objGraphics.Cle ar(Drawing.Colo r.White)
Dim p As New Drawing.Pen(Dra wing.Color.Yell ow, 0)
Dim rect As New Drawing.Rectang le(10, 10, 280, 280)
'objGraphics.Dr awEllipse(p, rect)
Dim b1 As New Drawing.SolidBr ush(Drawing.Col or.Red)
Dim b2 As New Drawing.SolidBr ush(Drawing.Col or.Green)
Dim b3 As New Drawing.SolidBr ush(Drawing.Col or.Blue)
objGraphics.Fil lPie(b1, rect, 0.0, 90.0)
objGraphics.Fil lPie(b2, rect, 90.0, 60.0)
objGraphics.Fil lPie(b3, rect, 150.0, 210.0)
Dim fontfml As New
Drawing.FontFam ily(Drawing.Tex t.GenericFontFa milies.Serif)
Dim font As New Drawing.Font(fo ntfml, 14)
Dim brush As New Drawing.SolidBr ush(Drawing.Col or.Black)
objGraphics.Dra wString("Missy Mosley", font, brush, 100, 300)
Dim i As Image = New Image
Dim mStream As MemoryStream = New MemoryStream
Dim httpApp As HttpApplication = New HttpApplication
objBitmap.Save( Response.Output Stream,
Drawing.Imaging .ImageFormat.Gi f)
Comment