C# WinForms透明图片框不工作

C# WinForms透明图片框不工作,c#,.net,winforms,C#,.net,Winforms,我一直在尝试在背景上放置一个黑色/灰色的图像,我希望在图像的透明部分显示背景。图像绝对正确地保存为透明png。下面的代码有什么问题 this.pictureBox14.BackColor = System.Drawing.Color.Transparent; this.pictureBox14.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox14.BackgroundImage"))); this.

我一直在尝试在背景上放置一个黑色/灰色的图像,我希望在图像的透明部分显示背景。图像绝对正确地保存为透明png。下面的代码有什么问题

this.pictureBox14.BackColor = System.Drawing.Color.Transparent;
this.pictureBox14.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox14.BackgroundImage")));
this.pictureBox14.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.pictureBox14.Cursor = System.Windows.Forms.Cursors.Hand;
this.pictureBox14.Location = new System.Drawing.Point(486, 337);
this.pictureBox14.Name = "pictureBox14";
this.pictureBox14.Size = new System.Drawing.Size(69, 62);
this.pictureBox14.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox14.TabIndex = 18;
this.pictureBox14.TabStop = false;
this.pictureBox14.Click += new System.EventHandler(this.pictureBox14_Click);

图像上需要透明的颜色是什么?在运行时发布一张照片?我发现解决方案是这样做。pictureBox.parent=this.parentPictureBox如果要对范围3-25中的所有图片框执行此操作,这里有一个方便的python脚本:([print(“this.pictureBox”+str(x)+“。parent=this.pictureBox;”。对于范围(3,25)中的x)@SwimBikeRun请发布您自己的解决方案作为答案,并将其标记为已接受