看板 C_Sharp 關於我們 聯絡資訊
※ 引述《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
F23ko:原來如此,只對parent有反應... 02/21 19:36
F23ko:試過之後發現.... 整個lable消失了 @@ 02/21 22:21
proach:我試可以哩 @_@ 02/22 00:04
bdvstg:我也OK!! 02/22 00:12
optimist9266:GDI繪製的透明經常會因為系統設定的差異出現效果的 02/22 16:55
optimist9266:不同 如果顯示卡比較差 系統也就會自動忽略透明設定 02/22 16:55
optimist9266:Form的TransparentKey有時候也會受到這個影響 02/22 16:56
F23ko:囧.... 原來如次.... 02/22 18:52
F23ko:成功了 囧.... 02/22 19:45