VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Smooth Scrolling"
   ClientHeight    =   4260
   ClientLeft      =   120
   ClientTop       =   450
   ClientWidth     =   7065
   LinkTopic       =   "Form1"
   ScaleHeight     =   4260
   ScaleWidth      =   7065
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Picture2 
      Height          =   615
      Left            =   480
      ScaleHeight     =   555
      ScaleWidth      =   6195
      TabIndex        =   2
      Top             =   3480
      Width           =   6255
   End
   Begin VB.Timer Timer1 
      Interval        =   10
      Left            =   6360
      Top             =   600
   End
   Begin VB.PictureBox Picture1 
      Height          =   615
      Left            =   480
      ScaleHeight     =   555
      ScaleWidth      =   6195
      TabIndex        =   0
      Top             =   2520
      Width           =   6255
      Begin VB.Label Label1 
         Caption         =   "Make this text scroll without a flicker"
         Height          =   375
         Left            =   3360
         TabIndex        =   1
         Top             =   120
         Width           =   2895
      End
   End
   Begin VB.Label Label3 
      Caption         =   "BitBlting gets rid of the flicker"
      Height          =   255
      Left            =   480
      TabIndex        =   4
      Top             =   3240
      Width           =   2295
   End
   Begin VB.Label Label2 
      Caption         =   "This text will flicker"
      Height          =   255
      Left            =   480
      TabIndex        =   3
      Top             =   2280
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
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 Const SRCCOPY = &HCC0020

Private Sub Timer1_Timer()
    Label1.Move Label1.Left - 20 ' move the label to the left for scrolling effect
    If Label1.Left < -Label1.Width Then Label1.Left = Picture1.Width
    Me.Picture1.CurrentY = Me.Label1.Top ' use the label coordinates to set printing position
    Me.Picture1.CurrentX = Me.Label1.Left ' use the label coordinates to set the printing position
    Me.Picture1.Print Me.Label1 ' print the label text on to the picture box
    Picture2.Cls ' clear the destination picbox
    BitBlt Picture2.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hDC, 0, 0, SRCCOPY ' bitblt picture1 to picture2 to remove flicker
End Sub
