2013-04-10 67 views

回答

4

您可以使用Bitmap类MakeTransparent方法。因此,这将是像

Bitmap b = new Bitmap("img.jpg") 
b.MakeTransparent(Color.White); 
pictureBox.Image = b; 

但我建议你使用PNG而不是JPG这个原因:1)更好的质量(像这样的图像)C)更小的尺寸对于像本B图像)的原生支持透明背景。

看看它们之间有什么不同http://www.bing.com/search?setmkt=en-US&q=PNG+vs+JPG

1

尝试

Bitmap bmp = (Bitmap)Image.FromFile(@"C:\your_k.bmp"); //Load a bitmap from file 
    bmp.MakeTransparent(Color.White) //Do the work! 
    //if you have a varient color combination you can use RGB Combination as follows 
    //bmp.MakeTransparent(Color.FromArgb(255, 255 255)); // (255 255, 255) is white! 
    this.pictureBox1.Image = bmp; 
    this.pictureBox1.BackColor = Color.Transparent; //makes humbly only your object!