在C#PictureBox中删除特定的颜色/背景

时间:2019-01-05 10:07:17

标签: c# forms background picturebox transparent

我正在尝试从C#表单的图片框中删除白色背景,就像here所示。

我已经尝试使用BackColor = Color.Transparent;,但是,这没有用。

还有另一种解决方法吗?也许有什么功能可以让我去除白色?

任何帮助表示赞赏。谢谢!

2 个答案:

答案 0 :(得分:0)

您需要使用支持透明度的.png图像。

答案 1 :(得分:0)

确保图片中的背景是透明的 然后添加以下代码:

this.*picturebox1.Parent = this.Form1**; this.*picturebox1.BackColor = Color.transparent;

注意: * =您为图片框命名的任何名称

** =可以是任何结构,例如面板,图片框等