我拉了两个picturebox,picturebox1、picturebox2 picturebox1放在picturebox2的前面(picturebox2被遮住了),现在我想让picturebox1的背景变透明,从而看到picturebox2的内容,结果用这样的方法:pictureBox1.BackColor = Color.Empty;
pictureBox1.BringToFront();
把picturebox2被遮住的部分也透明掉了(直接透到了form1的背景)
有什么方法之透明掉picturebox1,能看到那被遮住的picturebox2的部分?效果是这样的(picturebox1还在picturebox2上面,透明掉了后,picturebox2被遮住的部分也能正常显示)求代码+解释
你就是要让PictureBox1不遮住PictureBox2是吗,你把PictureBox1是放在PictureBox2上的,本来就不会遮住呀你设置透明这些东西做什么呀?
把问题是说清楚些
hi
can anyone help to solve my problem.
i have two picture boxes one on top of other.the picture box behibd the top one shows live video from web cam . i want the picture box on top to be transparent so that i can view the video in the second picturebox through the transaprent one for c# application.
thanks ramyaCheck out MSDN Library on "ControlStyles" flag and "SupportsTransparentBackColor" and "Opaque" style. By using these styles and providing a background color with an "alpha" value you can make it transparent. All you need is to play with the alpha level of the System.Drawing.Color structure.BluehunterMSDN给出的方法,里面有c#例:
Giving Your Control a Transparent Background
http://msdn.microsoft.com/en-us/library/wk5b13s4(VS.71).aspx一个实现标签变成透明的例子:
http://www.codeproject.com/KB/static/translabelcontrol.aspx
四楼!这样不行!
http://www.codeproject.com/KB/static/translabelcontrol.aspx
貌似把背景给绘了出来,但这太长了吧,有没有简单的方法?
SetStyle(ControlStyles.SupportsTransparentBackColor, True);
但即便这样Picturebox是不能真真做到透明效果的,但能做到的只是假的透明。引用No it doesnt work. It only makes the picturebox's back color same as the background.But its not transparent in real sense.
要真真实现,很麻烦的.但我也的确发现有人真的做到过:
http://www.bobpowell.net/transcontrols.htm
pictureBox1.Invalidate();
PictureBOX想要重叠透明。改用WPF