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