我正在尝试从.aspx页面返回透明的GIF,以便在网页中显示.我试图让图像具有透明度,但是我只是不断地将黑色变成透明的图像.
有谁知道我做错了什么?
Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) _ Handles Me.Load '' Change the response headers to output a GIF image. Response.Clear() Response.ContentType = "image/gif" Dim width = 110 Dim height = width '' Create a new 32-bit bitmap image Dim b = New Bitmap(width,height) '' Create Grahpics object for drawing Dim g = Graphics.FromImage(b) Dim rect = New Rectangle(0,width - 1,height - 1) '' Fill in with Transparent Dim tbrush = New System.Drawing.solidBrush(Color.Transparent) g.FillRectangle(tbrush,rect) '' Draw Circle Border Dim bPen = Pens.Red g.DrawPie(bPen,rect,365) '' Fill in Circle Dim cbrush = New SolidBrush(Color.LightBlue) g.FillPie(cbrush,365) '' Clean up g.Flush() g.dispose() '' Make Transparent b.MakeTransparent() b.Save(Response.OutputStream,Imaging.ImageFormat.Gif) Response.Flush() Response.End() End Sub
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。