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 / ch25code / mdiole.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-27  |  8.7 KB  |  221 lines

  1. VERSION 4.00
  2. Begin VB.MDIForm mdiOLE 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "OLE Container Control Example"
  5.    ClientHeight    =   4170
  6.    ClientLeft      =   375
  7.    ClientTop       =   1845
  8.    ClientWidth     =   5790
  9.    Height          =   4860
  10.    Icon            =   "MDIOLE.frx":0000
  11.    Left            =   315
  12.    LinkTopic       =   "MDIForm1"
  13.    Top             =   1215
  14.    Width           =   5910
  15.    Begin VB.PictureBox StatusBar 
  16.       Align           =   2  'Align Bottom
  17.       Appearance      =   0  'Flat
  18.       BackColor       =   &H00C0C0C0&
  19.       ForeColor       =   &H80000008&
  20.       Height          =   420
  21.       Left            =   0
  22.       ScaleHeight     =   390
  23.       ScaleWidth      =   5760
  24.       TabIndex        =   1
  25.       Top             =   3750
  26.       Width           =   5790
  27.       Begin VB.Label lblStatus 
  28.          BackStyle       =   0  'Transparent
  29.          Caption         =   "Ready"
  30.          Height          =   240
  31.          Left            =   90
  32.          TabIndex        =   2
  33.          Top             =   90
  34.          Width           =   5505
  35.       End
  36.    End
  37.    Begin VB.PictureBox Toolbar 
  38.       Align           =   1  'Align Top
  39.       Appearance      =   0  'Flat
  40.       BackColor       =   &H00C0C0C0&
  41.       ForeColor       =   &H80000008&
  42.       Height          =   420
  43.       Left            =   0
  44.       ScaleHeight     =   390
  45.       ScaleWidth      =   5760
  46.       TabIndex        =   0
  47.       Top             =   0
  48.       Width           =   5790
  49.       Begin MSComDlg.CommonDialog cdlg 
  50.          Left            =   1440
  51.          Top             =   0
  52.          _Version        =   65536
  53.          _ExtentX        =   847
  54.          _ExtentY        =   847
  55.          _StockProps     =   0
  56.          DefaultExt      =   "ole"
  57.          Filter          =   "OLE Object (*.ole)|*.ole|All Files (*.*)|*.*"
  58.          FilterIndex     =   1
  59.       End
  60.       Begin VB.Image imgHold 
  61.          Height          =   315
  62.          Left            =   900
  63.          Top             =   45
  64.          Visible         =   0   'False
  65.          Width           =   360
  66.       End
  67.       Begin VB.Image imgTools 
  68.          Height          =   330
  69.          Index           =   1
  70.          Left            =   495
  71.          Picture         =   "MDIOLE.frx":030A
  72.          Top             =   45
  73.          Visible         =   0   'False
  74.          Width           =   360
  75.       End
  76.       Begin VB.Image imgTools 
  77.          Height          =   330
  78.          Index           =   0
  79.          Left            =   90
  80.          Picture         =   "MDIOLE.frx":0494
  81.          Top             =   45
  82.          Width           =   360
  83.       End
  84.    End
  85.    Begin VB.Menu mnuFile 
  86.       Caption         =   "&File"
  87.       NegotiatePosition=   1  'Left
  88.       Begin VB.Menu mnuFileItems 
  89.          Caption         =   "E&xit"
  90.          Index           =   1
  91.       End
  92.    End
  93. Attribute VB_Name = "mdiOLE"
  94. Attribute VB_Creatable = False
  95. Attribute VB_Exposed = False
  96. '*********************************************************************
  97. ' MDIOLE.FRM - MDI Parent Form
  98. '*********************************************************************
  99. Option Explicit
  100. '*********************************************************************
  101. ' Saves the button image in imgHold, and inserts the down picture
  102. '*********************************************************************
  103. Private Sub imgTools_MouseDown(Index As Integer, Button As Integer, _
  104.                            Shift As Integer, X As Single, Y As Single)
  105.     imgHold.picture = imgTools(Index).picture
  106.     imgTools(Index).picture = imgTools(Index + 1).picture
  107. End Sub
  108. '*********************************************************************
  109. ' Updates the status bar
  110. '*********************************************************************
  111. Private Sub imgTools_MouseMove(Index As Integer, Button As Integer, _
  112.                            Shift As Integer, X As Single, Y As Single)
  113.     UpdateStatus lblStatus, "Closes " & Caption
  114. End Sub
  115. '*********************************************************************
  116. ' Restores the graphic, and closes the application
  117. '*********************************************************************
  118. Private Sub imgTools_MouseUp(Index As Integer, Button As Integer, _
  119.                          Shift As Integer, X As Single, Y As Single)
  120.     imgTools(Index).picture = imgHold.picture
  121.     Unload Me
  122. End Sub
  123. '*********************************************************************
  124. ' Prepares the application for use
  125. '*********************************************************************
  126. Private Sub MDIForm_Load()
  127.     BackColor = vb3DFace
  128.     Toolbar.BackColor = vb3DFace
  129.     StatusBar.BackColor = vb3DFace
  130.     WindowState = 2
  131.     frmWord.Show
  132.     Arrange vbTileHorizontal
  133. End Sub
  134. '*********************************************************************
  135. ' Updates the status bar with the default text
  136. '*********************************************************************
  137. Private Sub MDIForm_MouseMove(Button As Integer, Shift As Integer, _
  138.                                             X As Single, Y As Single)
  139.     UpdateStatus lblStatus
  140. End Sub
  141. '*********************************************************************
  142. ' Terminates the application
  143. '*********************************************************************
  144. Private Sub mnuFileItems_Click(Index As Integer)
  145.     Unload Me
  146. End Sub
  147. '*********************************************************************
  148. ' Updates the status bar with the default text
  149. '*********************************************************************
  150. Private Sub StatusBar_MouseMove(Button As Integer, Shift As Integer, _
  151.                                              X As Single, Y As Single)
  152.     UpdateStatus lblStatus
  153. End Sub
  154. '*********************************************************************
  155. ' Adds a 3D appearance to the status bar
  156. '*********************************************************************
  157. Private Sub StatusBar_Paint()
  158.     HighlightBar StatusBar
  159.     Highlight lblStatus
  160. End Sub
  161. '*********************************************************************
  162. ' Updates the status bar with the default text
  163. '*********************************************************************
  164. Private Sub Toolbar_MouseMove(Button As Integer, Shift As Integer, _
  165.                                             X As Single, Y As Single)
  166.     UpdateStatus lblStatus
  167. End Sub
  168. '*********************************************************************
  169. ' Adds a 3D appearance to the toolbar
  170. '*********************************************************************
  171. Private Sub Toolbar_Paint()
  172.     HighlightBar Toolbar
  173. End Sub
  174. '*********************************************************************
  175. ' Adds a 3D effect to a picture box
  176. '*********************************************************************
  177. Private Sub HighlightBar(Bar As PictureBox)
  178.     Bar.Line (0, 5)-(Bar.ScaleWidth, 5), vb3DHighlight
  179.     Bar.Line (0, Bar.ScaleHeight - 15)-(Bar.ScaleWidth, _
  180.                         Bar.ScaleHeight - 15), vb3DShadow
  181. End Sub
  182. '*********************************************************************
  183. ' Adds a 3D border around a control
  184. '*********************************************************************
  185. Private Sub Highlight(Object As Control)
  186. Const HORIZONTAL_OFFSET = 50
  187. Const VERTICAL_OFFSET = 70
  188.     '*****************************************************
  189.     ' Top
  190.     '*****************************************************
  191.     StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
  192.                    Object.TOP - HORIZONTAL_OFFSET)- _
  193.                    (Object.Width, _
  194.                    Object.TOP - HORIZONTAL_OFFSET), _
  195.                    vb3DShadow
  196.     '*****************************************************
  197.     ' Left
  198.     '*****************************************************
  199.     StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
  200.                    Object.TOP - HORIZONTAL_OFFSET)- _
  201.                    (Object.Left - HORIZONTAL_OFFSET, _
  202.                    Object.Height + VERTICAL_OFFSET), _
  203.                    vb3DShadow
  204.     '*****************************************************
  205.     ' Bottom
  206.     '*****************************************************
  207.     StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
  208.                    Object.Height + VERTICAL_OFFSET)- _
  209.                    (Object.Width, _
  210.                    Object.Height + VERTICAL_OFFSET), _
  211.                    vb3DHighlight
  212.     '*****************************************************
  213.     ' Right
  214.     '*****************************************************
  215.     StatusBar.Line (Object.Width, _
  216.                     Object.TOP - HORIZONTAL_OFFSET)- _
  217.                    (Object.Width, _
  218.                    Object.Height + VERTICAL_OFFSET + 15), _
  219.                    vb3DHighlight
  220. End Sub
  221.