|
Private Sub Form_Activate()
'Clip image of picture2 to picture1 ScrollPic Picture2, Picture1, VScroll1 End Sub '_________________________________________________________ Private Sub Form_Load() 'Setta le proprieta' e la posizione degli oggetti With Me .Height = 5000 .Width = 6500 End With With VScroll1 .Left = 3200 .Top = 200 .Height = 1000 End With With Picture1 .Left = 200 .Top = 200 .Width = 3000 .Height = 1000 End With 'AutoRedraw deve essere setttato a True!!! With Picture2 .Left = 200 .Top = 1500 .Width = 3000 .Height = 2500 .Visible = False End With 'Variabili necessarie TwipsX = Screen.TwipsPerPixelX TwipsY = Screen.TwipsPerPixelY DestPicx = Picture2.Width / TwipsX DestPicY = Picture2.Height / TwipsY VScroll1.Max = Picture2.Height / TwipsY - Picture1.Height / TwipsY 'Scrive da A a L sulla Picture2 Dim i As Integer For i = 0 To 11 Picture2.Print Chr$(65 + i) Next i End Sub '_________________________________________________________ Private Sub VScroll1_Change() ScrollPic Picture2, Picture1, VScroll1 End Sub '_________________________________________________________ Private Sub VScroll1_Scroll() ScrollPic Picture2, Picture1, VScroll1 End Sub '_________________________________________________________ '3. Aggiungete un modulo con il seguente codice: Declare Function BitBlt Lib "gdi32" _ (ByVal hDestDC As Integer, ByVal x As Integer, _ ByVal y As Integer, ByVal nWidth As Integer, _ ByVal nHeight As Integer, ByVal hSrcDC As Integer, _ ByVal xSrc As Integer, ByVal ySrc As Integer, _ ByVal dwRop As Long) As Integer Public Const SRCCOPY = &HCC0020 Public Const SRCAND = &H8800C6 Public Const SRCINVERT = &H660046 Public TwipsX As Long Public TwipsY As Long Public DestPicx As Long Public DestPicY As Long '_________________________________________________________ Public Sub ScrollPic(SourcePic As Object, _ DestPic As Object, Scroll As Object) BitBlt DestPic.hDC, 0&, 0&, DestPicx, DestPicY, _ SourcePic.hDC, 0&, Scroll.Value, SRCCOPY End Sub |