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 < prev    next >
Text File  |  1995-08-12  |  3KB  |  151 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. End
  57. Attribute VB_Name = "Form1"
  58. Attribute VB_Creatable = False
  59. Attribute VB_Exposed = False
  60. Option Explicit
  61.  
  62. Private Sub Form_Load()
  63.     ' Use the automatic size mode to get
  64.     ' the best picture of the whole object.
  65.     OLE1.SizeMode = vbOLESizeAutoSize
  66.     OLE1.InsertObjDlg
  67. End Sub
  68.  
  69.  
  70.  
  71. Private Sub Form_Resize()
  72.     ' Keep controls form-sized.
  73.     picture1.Height = Me.ScaleHeight
  74.     picture1.Width = Me.ScaleWidth
  75.     OLE1.Height = Me.ScaleHeight
  76.     OLE1.Width = Me.ScaleWidth
  77. End Sub
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. Private Sub mnuClose_Click()
  91.     picture1.picture = OLE1.picture
  92.     OLE1.Close
  93.     OLE1.Visible = False
  94.     picture1.Visible = True
  95. End Sub
  96.  
  97. Private Sub mnuEdit_Click()
  98.     OLE1.Height = picture1.Height
  99.     OLE1.Width = picture1.Width
  100.     OLE1.Visible = True
  101.     picture1.Visible = False
  102.     OLE1.DoVerb -5
  103. End Sub
  104.  
  105. Private Sub mnuExit_Click()
  106.     End
  107. End Sub
  108.  
  109. Private Sub mnuNew_Click()
  110.     OLE1.Visible = True
  111.     picture1.Visible = False
  112.     OLE1.InsertObjDlg
  113. End Sub
  114.  
  115. Private Sub mnuOpen_Click()
  116.     OLE1.Height = picture1.Height
  117.     OLE1.Width = picture1.Width
  118.     OLE1.Visible = True
  119.     picture1.Visible = False
  120.     OLE1.DoVerb -2
  121. End Sub
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. Private Sub OLE1_Updated(Code As Integer)
  129.     Select Case Code
  130.         Case vbOLEChanged
  131.             ' Make sure application is running
  132.             ' (required for next step).
  133.             OLE1.AppIsRunning = True
  134.             ' Capture the image of the control.
  135.             picture1.picture = OLE1.picture
  136.         Case vbOLEClosed
  137.             ' Show the picture box instead of
  138.             ' the OLE control.
  139.             picture1.Visible = True
  140.             OLE1.Visible = False
  141.         Case Else
  142.             ' Do nothing.
  143.     End Select
  144. End Sub
  145.  
  146. Private Sub picture1_Click()
  147.     Me.PopupMenu mnuPopup, , , , mnuEdit
  148. End Sub
  149.  
  150.  
  151.