請問有誰知道如何把VB裡面PictureBox控制項的底色變成透明就跟Image一樣?
(P.S.我的圖片已經試用.gif而且已經透明處理過了)
我查過資料看過有backstyle這個屬性...可是我在VB6.0怎麼找也找不到????
2006-04-04 16:52:16 · 2 個解答 · 發問者 叡 1 in 電腦與網際網路 ➔ 程式設計
恩.....我會想要用picturebox是因為:我讓image移動(用timer去跑)的時候會有殘影的現象,圖片會一閃一閃的,而picturebox則不會有這樣的現象。
有誰知道如何可以讓image移動得時候不會有上述的現象呢????
P.S.感謝樓下二樓的大大,但是image放在picturebox是否也會有上述的現象阿??
2006-04-08 07:32:29 · update #1
'有個變通的辦法,將1個放有透空圖的Image元件放在PictureBox裡面,再讓PictureBox的底色顯示成同區域表單的顏色,這樣PictureBox看起來就好像有透空的效果'表單上置1個PictureBox,1個放有透空圖的Image,1個CommandButton,為了看出是否透空最好也將表單放上圖片Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As LongPrivate Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hDc As Long) As LongPrivate Declare Function StretchBlt Lib "gdi32" (ByVal hDc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPrivate Sub Command1_Click()Dim hDc&Me.ScaleMode = 3Set Image1.Container = Picture1Image1.Top = 0: Image1.Left = 0With Picture1 .ScaleMode = 3 .AutoRedraw = True .Visible = False DoEvents hDc = GetDC(Me.hwnd) StretchBlt .hDc, 0, 0, .ScaleWidth, .ScaleHeight, hDc, .Left + (.Width - .ScaleWidth) / 2, .Top + (.Height - .ScaleHeight) / 2, .ScaleWidth, .ScaleHeight, vbSrcCopy ReleaseDC Me.hwnd, hDc .Visible = True .AutoRedraw = FalseEnd WithEnd Sub
2006-04-07 08:44:51 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
答案是不行的
為何一定要PictureBox呢
如果一定要透明的話用Image就好了啊
2006-04-06 19:40:06 · answer #2 · answered by ? 2 · 0⤊ 0⤋