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 < prev    next >
Text File  |  1995-07-27  |  9KB  |  222 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. End
  94. Attribute VB_Name = "mdiOLE"
  95. Attribute VB_Creatable = False
  96. Attribute VB_Exposed = False
  97. '*********************************************************************
  98. ' MDIOLE.FRM - MDI Parent Form
  99. '*********************************************************************
  100. Option Explicit
  101. '*********************************************************************
  102. ' Saves the button image in imgHold, and inserts the down picture
  103. '*********************************************************************
  104. Private Sub imgTools_MouseDown(Index As Integer, Button As Integer, _
  105.                            Shift As Integer, X As Single, Y As Single)
  106.     imgHold.picture = imgTools(Index).picture
  107.     imgTools(Index).picture = imgTools(Index + 1).picture
  108. End Sub
  109. '*********************************************************************
  110. ' Updates the status bar
  111. '*********************************************************************
  112. Private Sub imgTools_MouseMove(Index As Integer, Button As Integer, _
  113.                            Shift As Integer, X As Single, Y As Single)
  114.     UpdateStatus lblStatus, "Closes " & Caption
  115. End Sub
  116. '*********************************************************************
  117. ' Restores the graphic, and closes the application
  118. '*********************************************************************
  119. Private Sub imgTools_MouseUp(Index As Integer, Button As Integer, _
  120.                          Shift As Integer, X As Single, Y As Single)
  121.     imgTools(Index).picture = imgHold.picture
  122.     Unload Me
  123. End Sub
  124. '*********************************************************************
  125. ' Prepares the application for use
  126. '*********************************************************************
  127. Private Sub MDIForm_Load()
  128.     BackColor = vb3DFace
  129.     Toolbar.BackColor = vb3DFace
  130.     StatusBar.BackColor = vb3DFace
  131.     WindowState = 2
  132.     frmWord.Show
  133.     Arrange vbTileHorizontal
  134. End Sub
  135. '*********************************************************************
  136. ' Updates the status bar with the default text
  137. '*********************************************************************
  138. Private Sub MDIForm_MouseMove(Button As Integer, Shift As Integer, _
  139.                                             X As Single, Y As Single)
  140.     UpdateStatus lblStatus
  141. End Sub
  142. '*********************************************************************
  143. ' Terminates the application
  144. '*********************************************************************
  145. Private Sub mnuFileItems_Click(Index As Integer)
  146.     Unload Me
  147. End Sub
  148. '*********************************************************************
  149. ' Updates the status bar with the default text
  150. '*********************************************************************
  151. Private Sub StatusBar_MouseMove(Button As Integer, Shift As Integer, _
  152.                                              X As Single, Y As Single)
  153.     UpdateStatus lblStatus
  154. End Sub
  155. '*********************************************************************
  156. ' Adds a 3D appearance to the status bar
  157. '*********************************************************************
  158. Private Sub StatusBar_Paint()
  159.     HighlightBar StatusBar
  160.     Highlight lblStatus
  161. End Sub
  162. '*********************************************************************
  163. ' Updates the status bar with the default text
  164. '*********************************************************************
  165. Private Sub Toolbar_MouseMove(Button As Integer, Shift As Integer, _
  166.                                             X As Single, Y As Single)
  167.     UpdateStatus lblStatus
  168. End Sub
  169. '*********************************************************************
  170. ' Adds a 3D appearance to the toolbar
  171. '*********************************************************************
  172. Private Sub Toolbar_Paint()
  173.     HighlightBar Toolbar
  174. End Sub
  175. '*********************************************************************
  176. ' Adds a 3D effect to a picture box
  177. '*********************************************************************
  178. Private Sub HighlightBar(Bar As PictureBox)
  179.     Bar.Line (0, 5)-(Bar.ScaleWidth, 5), vb3DHighlight
  180.     Bar.Line (0, Bar.ScaleHeight - 15)-(Bar.ScaleWidth, _
  181.                         Bar.ScaleHeight - 15), vb3DShadow
  182. End Sub
  183. '*********************************************************************
  184. ' Adds a 3D border around a control
  185. '*********************************************************************
  186. Private Sub Highlight(Object As Control)
  187. Const HORIZONTAL_OFFSET = 50
  188. Const VERTICAL_OFFSET = 70
  189.     '*****************************************************
  190.     ' Top
  191.     '*****************************************************
  192.     StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
  193.                    Object.TOP - HORIZONTAL_OFFSET)- _
  194.                    (Object.Width, _
  195.                    Object.TOP - HORIZONTAL_OFFSET), _
  196.                    vb3DShadow
  197.     '*****************************************************
  198.     ' Left
  199.     '*****************************************************
  200.     StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
  201.                    Object.TOP - HORIZONTAL_OFFSET)- _
  202.                    (Object.Left - HORIZONTAL_OFFSET, _
  203.                    Object.Height + VERTICAL_OFFSET), _
  204.                    vb3DShadow
  205.     '*****************************************************
  206.     ' Bottom
  207.     '*****************************************************
  208.     StatusBar.Line (Object.Left - HORIZONTAL_OFFSET, _
  209.                    Object.Height + VERTICAL_OFFSET)- _
  210.                    (Object.Width, _
  211.                    Object.Height + VERTICAL_OFFSET), _
  212.                    vb3DHighlight
  213.     '*****************************************************
  214.     ' Right
  215.     '*****************************************************
  216.     StatusBar.Line (Object.Width, _
  217.                     Object.TOP - HORIZONTAL_OFFSET)- _
  218.                    (Object.Width, _
  219.                    Object.Height + VERTICAL_OFFSET + 15), _
  220.                    vb3DHighlight
  221. End Sub
  222.