home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch13code / piczoom.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-12  |  3.3 KB  |  121 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   4512
  5.    ClientLeft      =   2760
  6.    ClientTop       =   2388
  7.    ClientWidth     =   7740
  8.    Height          =   5064
  9.    Left            =   2712
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4512
  12.    ScaleWidth      =   7740
  13.    Top             =   1884
  14.    Width           =   7836
  15.    Begin VB.PictureBox Picture1 
  16.       Height          =   4572
  17.       Left            =   0
  18.       ScaleHeight     =   4524
  19.       ScaleWidth      =   7764
  20.       TabIndex        =   1
  21.       Top             =   0
  22.       Width           =   7812
  23.    End
  24.    Begin VB.OLE OLE1 
  25.       Height          =   4572
  26.       Left            =   0
  27.       TabIndex        =   0
  28.       Top             =   0
  29.       Width           =   7692
  30.    End
  31.    Begin VB.Menu mnuFile 
  32.       Caption         =   "&File"
  33.       NegotiatePosition=   1  'Left
  34.       Begin VB.Menu mnuNew 
  35.          Caption         =   "&New Object"
  36.       End
  37.       Begin VB.Menu mnuClose 
  38.          Caption         =   "&Close Object"
  39.       End
  40.       Begin VB.Menu mnuSep1 
  41.          Caption         =   "-"
  42.       End
  43.       Begin VB.Menu mnuExit 
  44.          Caption         =   "E&xit"
  45.       End
  46.    End
  47.    Begin VB.Menu mnuPopup 
  48.       Caption         =   ""
  49.       Begin VB.Menu mnuEdit 
  50.          Caption         =   "&Edit"
  51.       End
  52.       Begin VB.Menu mnuOpen 
  53.          Caption         =   "&Open"
  54.       End
  55.    End
  56. Attribute VB_Name = "Form1"
  57. Attribute VB_Creatable = False
  58. Attribute VB_Exposed = False
  59. Option Explicit
  60. Private Sub Form_Load()
  61.     ' Use the automatic size mode to get
  62.     ' the best picture of the whole object.
  63.     OLE1.SizeMode = vbOLESizeAutoSize
  64.     OLE1.InsertObjDlg
  65. End Sub
  66. Private Sub Form_Resize()
  67.     ' Keep controls form-sized.
  68.     picture1.Height = Me.ScaleHeight
  69.     picture1.Width = Me.ScaleWidth
  70.     OLE1.Height = Me.ScaleHeight
  71.     OLE1.Width = Me.ScaleWidth
  72. End Sub
  73. Private Sub mnuClose_Click()
  74.     picture1.picture = OLE1.picture
  75.     OLE1.Close
  76.     OLE1.Visible = False
  77.     picture1.Visible = True
  78. End Sub
  79. Private Sub mnuEdit_Click()
  80.     OLE1.Height = picture1.Height
  81.     OLE1.Width = picture1.Width
  82.     OLE1.Visible = True
  83.     picture1.Visible = False
  84.     OLE1.DoVerb -5
  85. End Sub
  86. Private Sub mnuExit_Click()
  87.     End
  88. End Sub
  89. Private Sub mnuNew_Click()
  90.     OLE1.Visible = True
  91.     picture1.Visible = False
  92.     OLE1.InsertObjDlg
  93. End Sub
  94. Private Sub mnuOpen_Click()
  95.     OLE1.Height = picture1.Height
  96.     OLE1.Width = picture1.Width
  97.     OLE1.Visible = True
  98.     picture1.Visible = False
  99.     OLE1.DoVerb -2
  100. End Sub
  101. Private Sub OLE1_Updated(Code As Integer)
  102.     Select Case Code
  103.         Case vbOLEChanged
  104.             ' Make sure application is running
  105.             ' (required for next step).
  106.             OLE1.AppIsRunning = True
  107.             ' Capture the image of the control.
  108.             picture1.picture = OLE1.picture
  109.         Case vbOLEClosed
  110.             ' Show the picture box instead of
  111.             ' the OLE control.
  112.             picture1.Visible = True
  113.             OLE1.Visible = False
  114.         Case Else
  115.             ' Do nothing.
  116.     End Select
  117. End Sub
  118. Private Sub picture1_Click()
  119.     Me.PopupMenu mnuPopup, , , , mnuEdit
  120. End Sub
  121.