是否有可能与透明图像两个重叠的PictureBox控件? [英] Is it possible to have two overlapping PictureBox controls with transparent images?

查看:1690
本文介绍了是否有可能与透明图像两个重叠的PictureBox控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两个重叠 图片框控制中,我试图使画面中的透明区域让控制之下(在z顺序)是可见的。

Having two overlapping PictureBox controls, I'm trying to make the transparent areas of the picture box let the controls below (in the z-order) being visible.

即使尝试微软建议,我不能得到想要的的结果。

Even after trying what Microsoft suggests, I cannot get the desired result.

这是我目前有:

这就是我想要的:

所以我的问题是:

任何方式来实现我与期望的结果两个图片框控件(或另一种方式)相互重叠的,让透明区域,通过亮?

Any way to achieve my desired result with two PictureBox controls (or with another way) that overlap each other and let the transparent areas shine through?

更新:

其实我解决了它使用这个答案到的SO问题<一href="http://stackoverflow.com/questions/395256/transparent-images-with-c-sharp-winforms">Transparent用C#的WinForms图片。

Actually I solved it by using this answer to the the SO question "Transparent images with C# WinForms".

推荐答案

试试这个

private void Form1_Load(object sender, EventArgs e)
{
  // Transparent background...  
  pictureBoxOverlay.BackColor = Color.Transparent;

  // Change parent for overlay PictureBox...
  pictureBoxOverlay.Parent    = pictureBoxMain;

 // Change overlay PictureBox position in new parent...
 // pictureBoxOverlay.Location  = new Point(0, 0);
}

结果

llink

这篇关于是否有可能与透明图像两个重叠的PictureBox控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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