home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / articles / vbpj / source / evtprog1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-29  |  2.3 KB  |  72 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Events - initializtion & painting"
  6.    ClientHeight    =   3765
  7.    ClientLeft      =   1020
  8.    ClientTop       =   1590
  9.    ClientWidth     =   4035
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   4170
  21.    Left            =   960
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   3765
  24.    ScaleWidth      =   4035
  25.    Top             =   1245
  26.    Width           =   4155
  27.    Begin VB.PictureBox Picture1 
  28.       Appearance      =   0  'Flat
  29.       BackColor       =   &H80000005&
  30.       ForeColor       =   &H80000008&
  31.       Height          =   2655
  32.       Left            =   300
  33.       ScaleHeight     =   2625
  34.       ScaleWidth      =   2685
  35.       TabIndex        =   0
  36.       Top             =   480
  37.       Width           =   2715
  38.    End
  39. Attribute VB_Name = "Form1"
  40. Attribute VB_Creatable = False
  41. Attribute VB_Exposed = False
  42. Option Explicit
  43. ' This function adjusts the positions of screen elements
  44. ' for this form
  45. Private Sub AdjustPositions()
  46.     ' Set the picture control flush with the left side,
  47.     ' keep the current width, but fill the height of the form
  48.     picture1.Move 0, 0, picture1.Width, ScaleHeight
  49.     ' Be sure the picture is large enough
  50.     If ScaleWidth < 3600 Then
  51.         Move Left, Top, 3700, Height
  52.         Exit Sub
  53.     End If
  54. End Sub
  55. Private Sub Form_Resize()
  56.     ' 1:    Every form gets a resize event when it is
  57.     '       created.
  58.     '       It also gets this event when the form is
  59.     '       resized by the user
  60.     AdjustPositions
  61. End Sub
  62. Private Sub Picture1_Paint()
  63.     ' 2 -   The Paint event occurs when any part of the window
  64.     '       needs to be updated.
  65.     picture1.Line (0, 0)-(picture1.ScaleWidth, picture1.ScaleHeight)
  66. End Sub
  67. Private Sub Picture1_Resize()
  68.     ' 3 - In this case we also need to force an update
  69.     '       any time the size of the picture changes.
  70.     picture1.Refresh
  71. End Sub
  72.