2024年2月21日发(作者:)

VB中的PictureBox背景透明效果

Private Declare Function BitBlt Lib "gdi32 " (ByVal hDestDC As

Long, ByVal X As L

ong, 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 Const SRCCOPY = &HCC0020 ' (DWORD) dest = source

Dim dx As Long, dy As Long

Private Sub Form_MouseDown(Button As Integer, Shift As Integer,

X As Single, Y A

s Single)

dx = X

dy = Y

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer,

X As Single, Y A

s Single)

If Button = vbLeftButton Then

X + - dx, Y + - dy

End If

End Sub

Private Sub Timer1_Timer()

X + - dx, Y + - dy

e = False

draw = True

h

BitBlt , 0, 0, 300, 300, , () /

ipsPerPixelX, () / erPixelY, SRCCOPY

e = True

d = False

End Sub