2013-04-10 41 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!