Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Net如何将不透明度更改为图像或位图?_Vb.net_Graphics_Drawing - Fatal编程技术网

Vb.net Net如何将不透明度更改为图像或位图?

Vb.net Net如何将不透明度更改为图像或位图?,vb.net,graphics,drawing,Vb.net,Graphics,Drawing,我在VB.Net中有一个sub来执行图像的不透明度,但是,它的工作方式与我预期的不同: 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

我在VB.Net中有一个sub来执行图像的不透明度,但是,它的工作方式与我预期的不同:

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

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

@Brad:使参数的图像更透明更改位图图像的不透明度