2012-06-23 28 views
0

我想与透明像素替换“file.bmp”每个黑象素Vb.net变化像素颜色设为透明

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 

例外:

因为这种评估可能造成的副作用,直到用户启用才会执行 。 System.Drawing.Color

没有breakPoint图片框看起来像是空的。

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

回答