vb6.0 如何让frame和option的背景色与image中图片的颜色一致?
话句话说就是让frame和option变透明。因为frame和option中没有backstyle属性,所以能否考虑一下用取色函数完成之。(背景是在image中插入的图片...
话句话说就是让frame和option变透明。因为frame和option中没有backstyle属性,所以能否考虑一下用取色函数完成之。(背景是在image中插入的图片)
求代码。万分感谢! 展开
求代码。万分感谢! 展开
展开全部
在Microsoft Forms 2.0控件组中的单选按钮可以透明,Frame可以用线框或Microsoft Forms 2.0中的Image来代替,不过它们不能作为容器控件。
可以用图片框作Frame,在载入时把被它覆盖的窗口背景部分图像复制到图片框模仿透明效果。
下面代码把图片框Picture1覆盖的窗口背景复制图片框里:
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Load()
With Picture1
.AutoRedraw = True
Me.Show
.Visible = False
DoEvents
Dim rc As RECT
GetClientRect .hwnd, rc
Dim P As POINTAPI
P.x = rc.Left
P.y = rc.Top
ClientToScreen .hwnd, P
ScreenToClient Me.hwnd, P
BitBlt .hDC, 0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top, Me.hDC, P.x, P.y, vbSrcCopy
.Visible = True
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询