相关疑难解决方法(0)

如何使用System.Drawing绘制透明图像?

我正在尝试从.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, 0, width - 1, height - 1)

    '' Fill in with Transparent
    Dim tbrush = …
Run Code Online (Sandbox Code Playgroud)

asp.net transparency system.drawing gif

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

asp.net ×1

gif ×1

system.drawing ×1

transparency ×1