0

我在 VB.Net 中有一个子程序来执行图像的不透明度,但是,它不像我期望的那样工作:

Public Sub mc_SetOpacity(ByRef Image As Image, ByVal Opacity As Double)
        Dim vGraphics As Graphics = Graphics.FromImage(Image)
        Dim vColorMatrix As New ColorMatrix()
        Dim vImgAtt As New ImageAttributes()

        vColorMatrix.Matrix33 = Opacity

        vImgAtt.SetColorMatrix(vColorMatrix, ColorMatrixFlag.[Default], ColorAdjustType.Bitmap)
        vGraphics.DrawImage(Image, New Rectangle(0, 0, Image.Width, Image.Height), 0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, vImgAtt)

        vGraphics.Dispose() : vGraphics = Nothing
        vImgAtt.Dispose() : vImgAtt = Nothing
    End Sub

有人可以告诉我我做错了什么吗?

4

0 回答 0