A
angus
<%@ Page Language = "VB" ContentType="image/Png" %>
<%@ Import Namespace = "System.Drawing"%>
<%@ Import Namespace = "System.Drawing.Imaging"%>
<%@ Import Namespace = "System.Drawing.Drawing2D"%>
<%
Response.Clear()
Dim height As integer = 100
Dim width As integer = 200
Dim bmp As New Bitmap(width, height, PixelFormat.Format24bppRgb)
Dim g As Graphics = Graphics.FromImage(bmp)
g.SmoothingMode = SmoothingMode.AntiAlias
g.Clear(Color.White)
g.FillRectangle(New SolidBrush(Color.LightGray), 1, 1, 150, 50)
g.DrawString("Zone", New Font("Verdana", 10), SystemBrushes.WindowText, New
PointF(10, 15))
bmp.Save(Response.OutputStream, ImageFormat.Png)
g.Dispose()
bmp.Dispose()
Response.End()
%>
Error Msg
Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.
I wonder if i could generate png in asp.net by using "Dim bmp As New
Bitmap(width, height, PixelFormat.Format24bppRgb)" that?
If not so, what i should use?
Thank you.
Regards,
Angus
<%@ Import Namespace = "System.Drawing"%>
<%@ Import Namespace = "System.Drawing.Imaging"%>
<%@ Import Namespace = "System.Drawing.Drawing2D"%>
<%
Response.Clear()
Dim height As integer = 100
Dim width As integer = 200
Dim bmp As New Bitmap(width, height, PixelFormat.Format24bppRgb)
Dim g As Graphics = Graphics.FromImage(bmp)
g.SmoothingMode = SmoothingMode.AntiAlias
g.Clear(Color.White)
g.FillRectangle(New SolidBrush(Color.LightGray), 1, 1, 150, 50)
g.DrawString("Zone", New Font("Verdana", 10), SystemBrushes.WindowText, New
PointF(10, 15))
bmp.Save(Response.OutputStream, ImageFormat.Png)
g.Dispose()
bmp.Dispose()
Response.End()
%>
Error Msg
Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.
I wonder if i could generate png in asp.net by using "Dim bmp As New
Bitmap(width, height, PixelFormat.Format24bppRgb)" that?
If not so, what i should use?
Thank you.
Regards,
Angus