作者proach (pazroach)
看板C_Sharp
标题Re: [问题] 请问如何把元件的背景色用成透明?
时间Sun Feb 21 19:14:11 2010
※ 引述《F23ko (纯洁)》之铭言:
: 1.
: 我希望在picturbox上放label或是textbox
: 但是不希望背景色遮住图片
: 请问要如何把背景色设成透明?
: 2.
: 以及,有办法指定picturbox中的某一颜色为透明色吗?(不要档到下面的元件)
: 我试过用
: 在表单用TransparencyKey的方法
: 但是这会变成整个视窗透明,我可以从程式中的「洞」看见我的桌面 orz....
: 开始动手写个稍微复杂一点的程式之後
: 才发现自己不会的这麽多....
答案揭晓
http://www.devnewsgroups.net/windowsforms/
t4751-label-with-transparent-background.aspx <-- 请自行接上
When you set the label to transparent, it is transparent only to its
parent, in this case the form, so it shows the form's background
through the label.
If you want to to show the picture box through the label, you must set
the parent of the label to be the picture box:
Label1.Parent = PictureBox1 <-- 一行搞定!
Then the label will display properly.
多谢您想到这件事,我才发现自己不会的这麽多.... <(_,_)>
--
初中学生学中出
潮高教师教高潮
横批:小三学....
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.37.155.9
1F:推 F23ko:原来如此,只对parent有反应... 02/21 19:36
2F:推 F23ko:试过之後发现.... 整个lable消失了 @@ 02/21 22:21
3F:→ proach:我试可以哩 @_@ 02/22 00:04
4F:推 bdvstg:我也OK!! 02/22 00:12
5F:→ optimist9266:GDI绘制的透明经常会因为系统设定的差异出现效果的 02/22 16:55
6F:→ optimist9266:不同 如果显示卡比较差 系统也就会自动忽略透明设定 02/22 16:55
7F:→ optimist9266:Form的TransparentKey有时候也会受到这个影响 02/22 16:56
8F:推 F23ko:囧.... 原来如次.... 02/22 18:52
9F:推 F23ko:成功了 囧.... 02/22 19:45