home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / VBASIC / SCROLL.ZIP / SCROLL.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-03-04  |  3.9 KB  |  129 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H8000000F&
  4.    Caption         =   "Scrolling sample"
  5.    ClientHeight    =   3840
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1485
  8.    ClientWidth     =   8325
  9.    Height          =   4245
  10.    Left            =   1035
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3840
  13.    ScaleWidth      =   8325
  14.    Top             =   1140
  15.    Width           =   8445
  16.    Begin HScrollBar HScroll1 
  17.       Height          =   240
  18.       LargeChange     =   5
  19.       Left            =   120
  20.       TabIndex        =   6
  21.       Top             =   2640
  22.       Width           =   5295
  23.    End
  24.    Begin VScrollBar VScroll1 
  25.       Height          =   1935
  26.       LargeChange     =   5
  27.       Left            =   5400
  28.       TabIndex        =   5
  29.       Top             =   720
  30.       Width           =   255
  31.    End
  32.    Begin PictureBox Picture1 
  33.       Height          =   1935
  34.       Left            =   120
  35.       ScaleHeight     =   1905
  36.       ScaleWidth      =   5265
  37.       TabIndex        =   3
  38.       Top             =   720
  39.       Width           =   5295
  40.       Begin PictureBox picScroller 
  41.          AutoSize        =   -1  'True
  42.          Height          =   1935
  43.          Left            =   -15
  44.          ScaleHeight     =   1905
  45.          ScaleWidth      =   5265
  46.          TabIndex        =   4
  47.          Top             =   -15
  48.          Width           =   5295
  49.       End
  50.    End
  51.    Begin CommonDialog File 
  52.       DefaultExt      =   "BMP"
  53.       DialogTitle     =   "OPen BMP to scroll"
  54.       Filter          =   "Windows Bitmaps (*.bmp)|*.bmp|All files (*.*)|*.*"
  55.       Left            =   0
  56.       Top             =   2280
  57.    End
  58.    Begin CommandButton cmdLoad 
  59.       Caption         =   "Load Picture"
  60.       Height          =   495
  61.       Left            =   2880
  62.       TabIndex        =   2
  63.       Top             =   120
  64.       Width           =   2655
  65.    End
  66.    Begin CommandButton cmdScrollText 
  67.       Caption         =   "Scroll Text"
  68.       Height          =   495
  69.       Left            =   120
  70.       TabIndex        =   1
  71.       Top             =   120
  72.       Width           =   2655
  73.    End
  74.    Begin Timer Timer1 
  75.       Enabled         =   0   'False
  76.       Interval        =   50
  77.       Left            =   360
  78.       Top             =   2280
  79.    End
  80.    Begin Label Label1 
  81.       AutoSize        =   -1  'True
  82.       BackColor       =   &H8000000F&
  83.       Caption         =   "This is as smooth as it gets"
  84.       FontBold        =   -1  'True
  85.       FontItalic      =   0   'False
  86.       FontName        =   "MS Sans Serif"
  87.       FontSize        =   30
  88.       FontStrikethru  =   0   'False
  89.       FontUnderline   =   0   'False
  90.       Height          =   690
  91.       Left            =   480
  92.       TabIndex        =   0
  93.       Top             =   3000
  94.       Width           =   7650
  95.    End
  96. Option Explicit
  97. Sub cmdLoad_Click ()
  98.    ' Trap errors
  99.    On Error Resume Next
  100.    ' Generate error when user presses Cancel
  101.    File.CancelError = True
  102.    ' Show dialog
  103.    File.Action = 1
  104.    ' Load picture if no error occured
  105.    If Err = 0 Then
  106.       picScroller = LoadPicture(File.Filename)
  107.       VScroll1.Max = picScroller.Height / Screen.TwipsPerPixelY
  108.       HScroll1.Max = picScroller.Width / Screen.TwipsPerPixelX
  109.    End If
  110. End Sub
  111. Sub cmdScrollText_Click ()
  112.    Timer1.Enabled = Not Timer1.Enabled
  113.    If cmdScrollText.Caption = "Scroll Text" Then
  114.       cmdScrollText.Caption = "Stopp scrolling"
  115.    Else
  116.       cmdScrollText.Caption = "Scroll Text"
  117.    End If
  118. End Sub
  119. Sub HScroll1_Change ()
  120.    picScroller.Left = -(HScroll1.Value) * Screen.TwipsPerPixelX
  121. End Sub
  122. Sub Timer1_Timer ()
  123.    Label1.Left = Label1.Left - 15
  124.    If Label1.Left = -Label1.Width Then Label1.Left = Width
  125. End Sub
  126. Sub VScroll1_Change ()
  127.    picScroller.Top = -(VScroll1.Value) * Screen.TwipsPerPixelY
  128. End Sub
  129.