如何使图片框透明? [英] How to make picturebox transparent?

查看:218
本文介绍了如何使图片框透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做C#.NET的应用程序。我在这8图片框。我用PNG图像与透明背景,但在我的形式,它当谈到在另一个上面图片不是透明的。

I am making an application in C# .NET. I have 8 picture boxes in it. I used PNG images with transparent background but in my form it is not transparent when it comes above another image.

我使用Visual Studio 2012年。这是我的表格截图:

I am using Visual Studio 2012. This is a screenshot of my form:

推荐答案

要做到这一点的一种方法是通过改变重叠图片框的父超过其所精研图片框。由于Visual Studio设计不会让你一个PictureBox添加到图片框,这将在你的code(Form1.cs中)和Intializing函数内做:

One way to do this is by changing the parent of the overlapping picture box to the PictureBox over which it is lapping. Since the Visual Studio designer doesn't allow you to add a PictureBox to a PictureBox, this will have to be done in your code (Form1.cs) and within the Intializing function:

public Form1()
{
    InitializeComponent();
    pictureBox7.Controls.Add(pictureBox8);
    pictureBox8.Location = new Point(0, 0);
    pictureBox8.BackColor = Color.Transparent;
}

只要改变图片框的名字永远你需要什么。这将返回:

Just change the picture box names to what ever you need. This should return:

这篇关于如何使图片框透明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆