home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Samples / SCROLVB / SCROLVB.ZIP / SCROLL-X.FRM (.txt) < prev   
Encoding:
Visual Basic Form  |  1994-02-01  |  2.8 KB  |  80 lines

  1. VERSION 2.00
  2. Begin Form frmScroll 
  3.    BackColor       =   &H00FFFF00&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "frmScroll"
  6.    ControlBox      =   0   'False
  7.    Height          =   1020
  8.    Left            =   2520
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   41
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   265
  16.    Top             =   3435
  17.    Width           =   4095
  18.    Begin CommandButton cmdHome 
  19.       Caption         =   "Home"
  20.       Height          =   375
  21.       Index           =   0
  22.       Left            =   2040
  23.       TabIndex        =   1
  24.       Top             =   120
  25.       Width           =   1815
  26.    End
  27.    Begin CommandButton cmdStart 
  28.       Caption         =   "Click To Start"
  29.       Height          =   375
  30.       Left            =   120
  31.       TabIndex        =   0
  32.       Top             =   120
  33.       Width           =   1815
  34.    End
  35. ' SCROLL-X.FRM - Declarations.
  36.     DefInt A-Z
  37. ' End Of Declarations.
  38. Sub cmdHome_Click (Index As Integer)
  39. ' All of these buttons just move the scrolling form back up to the upper
  40. ' left corner, where it was before you started scrolling.
  41.     frmScroll.Move 0, 0
  42. End Sub
  43. Sub cmdStart_Click ()
  44. ' Hide this button right away.
  45.     cmdStart.Visible = False
  46. ' These are the PIXEL sizes that the scrolling form will be. Any number
  47. ' up to 32000 is alright. Over that size, things get flakey!
  48.     GoalWidth = 400
  49.     GoalHeight = 400
  50. ' Since the MDI child form external size is "Twips", you must convert the
  51. ' pixel goal to Twips, and THEN actually change the form size. In other
  52. ' words, when you give VB a Width or Height value, it expects a Twip value.
  53. ' To get this Twip value, you multiply your pixel size goal times the
  54. ' "number of Twips per pixel". VB has a built-in "Screen" object that will
  55. ' give you that number (it varies with different monitor types).
  56.     frmScroll.Width = GoalHeight * Screen.TwipsPerPixelX
  57.     frmScroll.Height = GoalHeight * Screen.TwipsPerPixelY
  58. ' Now duplicate the "Home" command button a few times, just to have some
  59. ' other sample controls on the form. These are not critical, and can be
  60. ' removed and replaced with any other kind of control.
  61.     For temp = 1 To 15
  62.     Load cmdHome(temp)
  63.     Next temp
  64. ' Adjust all of the cmdHome buttons, including #0, which was on the form
  65. ' at design time.
  66.     For x = 0 To 3
  67.     For y = 0 To 3
  68.         ' Figure out which one to move (0 to 15).
  69.         temp = (y * 4) + x
  70.         ' Calculate new location.
  71.         offsetX = 10 + (x * 100)
  72.         offsetY = 30 + (y * 100)
  73.         ' Move it, change caption, and show it.
  74.         cmdHome(temp).Move offsetX, offsetY, 80, 40
  75.         cmdHome(temp).Caption = "Home #" + Trim(temp)
  76.         cmdHome(temp).Visible = True
  77.     Next y
  78.     Next x
  79. End Sub
  80.