Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.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将像素颜色更改为透明_Vb.net_Winforms_Pixel - Fatal编程技术网

Vb.net将像素颜色更改为透明

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

我想用透明像素替换“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.Getpixel(x,y) = color.Black Then
                b.SetPixel(x, y, c)
               End if
            Next

     Next
        PictureBox1.Image = b
例外情况:

由于此评估可能会导致副作用,因此不会 在用户启用之前执行。系统、绘图、颜色

没有断点,picturebox看起来是空的


如何用透明像素替换黑色像素?

如果是位图,可以使用锁定位,操作像素,然后使用解锁位。 请参见此处的
示例,其中它将每三分之一的值设置为255
。24bpp位图将显示为红色。 -