Hi dD,
probier mal dieses:
' Controls: 3 * Picturebox
' Copyright © 2007 by Zardoz
Option Explicit
' AlphaBlend: NT/2000/XP/Vista: Included in Windows 2000 and later.
Private Declare Function AlphaBlend& Lib "msimg32.dll" (ByVal hdcDest&, ByVal _
XDest&, _
ByVal YDest&, ByVal WidthDest&, ByVal HeightDest&, ByVal hDCSrc&, ByVal _
xSrc&, _
ByVal ySrc&, ByVal WidthSrc&, ByVal HeightSrc&, ByVal Blendfunc&)
Private Declare Function BitBlt& Lib "gdi32.dll" (ByVal hdcDest&, ByVal XDest&, _
ByVal YDest&, _
ByVal nWidth&, ByVal nHeight&, ByVal hDCSrc&, ByVal xSrc&, ByVal ySrc&, ByVal _
dwRop&)
Private SW&, SH&, XPos!, YPos!
Private Sub Form_Load()
Dim Dat1$, Dat2$
Dat1 = "C:\Grund1.jpeg" 'Hintergrundbild
Dat2 = "C:\Objekt1.jpeg" ' Objektbild
Me.ScaleMode = vbPixels
With Picture1
.ScaleMode = vbPixels
.Move 0, 0
.AutoSize = True
Set .Picture = LoadPicture(Dat1)
.AutoRedraw = True
End With
With Picture3
.Visible = False
.ScaleMode = vbPixels
.AutoSize = True
Set .Picture = LoadPicture(Dat2)
SW = .ScaleWidth
SH = .ScaleHeight
.AutoRedraw = True
End With
With Picture2
.ScaleMode = vbPixels
.BorderStyle = vbBSNone
Set .Container = Picture1
.Move 8, 8, SW, SH
.AutoRedraw = True
End With
Call Picture2_MouseUp(0, 0, 0, 0)
End Sub
Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As _
Single, Y As Single)
XPos = X
YPos = Y
Picture2.ZOrder vbBringToFront
Call Picture2_MouseMove(Button, Shift, X, Y)
End Sub
Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As _
Single, Y As Single)
If Button = vbLeftButton Then
With Picture2
.Move .Left - XPos + X, .Top - YPos + Y
Call BitBlt(.hDC, 0, 0, SW, SH, Picture1.hDC, .Left, .Top, vbSrcCopy)
Call AlphaBlend(.hDC, 0, 0, SW, SH, Picture3.hDC, 0, 0, SW, SH, CLng( _
&H10000 * 128))
.Refresh
End With
End If
End Sub
Private Sub Picture2_MouseUp(Button As Integer, Shift As Integer, X As Single, _
Y As Single)
Call BitBlt(Picture2.hDC, 0, 0, SW, SH, Picture3.hDC, 0, 0, vbSrcCopy)
Picture2.Refresh
End Sub Gruss,
Zardoz |