Vb.net将像素颜色更改为透明
我想用透明像素替换“file.bmp”中的每个黑色像素Vb.net将像素颜色更改为透明,vb.net,winforms,pixel,Vb.net,Winforms,Pixel,我想用透明像素替换“file.bmp”中的每个黑色像素 Dim b As Bitmap = New Bitmap(64, 64) b = image.fromfile("c:/file.bmp") For y = 0 To 63 For x = 0 To 63 Dim c As New Color c = Color.Transparent If b.Getp
Dim b As Bitmap = New Bitmap(64, 64)
b = image.fromfile("c:/file.bmp")
For y = 0 To 63
For x = 0 To 63
Dim c As New Color
c = Color.Transparent
If b.Getpixel(x,y) = color.Black Then
b.SetPixel(x, y, c)
End if
Next
Next
PictureBox1.Image = b
例外情况:
由于此评估可能会导致副作用,因此不会
在用户启用之前执行。系统、绘图、颜色
没有断点,picturebox看起来是空的
如何用透明像素替换黑色像素?如果是位图,可以使用锁定位,操作像素,然后使用解锁位。 请参见此处的
示例,其中它将每三分之一的值设置为255
。24bpp位图将显示为红色。
-