'Open
New Project and add a module. Write down the public
function and constant as below. 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 Public Const SRCCOPY = &HCC0020 ' (DWORD) dest = source 'Put 2 picture box, and one button on the form.Write down the codes below on it. Private Sub Command1_Click() Dim mPict1Hdc, mPict2Hdc As Long mPict1Hdc = Picture1.hDC mPict2Hdc = Picture2.hDC If Command1.Caption = "Move Left" Then t& = BitBlt(mPict2Hdc, 0, 0, Picture2.Width, Picture2.Height, mPict1Hdc, 0, 0, SRCCOPY) Picture1.Picture = LoadPicture() Command1.Caption = "Move Right" Else t& = BitBlt(mPict1Hdc, 0, 0, Picture1.Width, Picture1.Height, mPict2Hdc, 0, 0, SRCCOPY) Picture2.Picture = LoadPicture() Command1.Caption = "Move Left" End If End Sub Private Sub Form_Load() Picture1.Picture = LoadPicture(App.Path & "\tips27.gif") Command1.Caption = "Move Left" End Sub
|