home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / MDI / MDI.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-12  |  14.7 KB  |  413 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.0#0"; "COMDLG16.OCX"
  3. Begin VB.MDIForm frmMDI 
  4.    BackColor       =   &H8000000C&
  5.    Caption         =   "MDI NotePad"
  6.    ClientHeight    =   3495
  7.    ClientLeft      =   915
  8.    ClientTop       =   2205
  9.    ClientWidth     =   5520
  10.    Height          =   3900
  11.    Left            =   855
  12.    LinkTopic       =   "MDIForm1"
  13.    Top             =   1860
  14.    Width           =   5640
  15.    Begin VB.PictureBox picToolbar 
  16.       Align           =   1  'Align Top
  17.       BeginProperty Font 
  18.          Name            =   "MS Sans Serif"
  19.          Size            =   8.25
  20.          Charset         =   0
  21.          Weight          =   700
  22.          Underline       =   0   'False
  23.          Italic          =   0   'False
  24.          Strikethrough   =   0   'False
  25.       EndProperty
  26.       Height          =   405
  27.       Left            =   0
  28.       ScaleHeight     =   345
  29.       ScaleWidth      =   5460
  30.       TabIndex        =   0
  31.       Top             =   0
  32.       Width           =   5520
  33.       Begin MSComDlg.CommonDialog CMDialog1 
  34.          Left            =   1995
  35.          Top             =   0
  36.          _ExtentX        =   847
  37.          _ExtentY        =   847
  38.          CancelError     =   -1  'True
  39.          DefaultExt      =   "TXT"
  40.          Filter          =   "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
  41.          FilterIndex     =   557
  42.          FontSize        =   1.27584e-37
  43.       End
  44.       Begin VB.Image imgPasteButtonUp 
  45.          Height          =   330
  46.          Left            =   5280
  47.          Picture         =   "MDI.frx":0000
  48.          Top             =   0
  49.          Visible         =   0   'False
  50.          Width           =   375
  51.       End
  52.       Begin VB.Image imgPasteButtonDn 
  53.          Height          =   330
  54.          Left            =   4920
  55.          Picture         =   "MDI.frx":01E2
  56.          Top             =   0
  57.          Visible         =   0   'False
  58.          Width           =   375
  59.       End
  60.       Begin VB.Image imgCopyButtonDn 
  61.          Height          =   330
  62.          Left            =   4200
  63.          Picture         =   "MDI.frx":03C4
  64.          Top             =   0
  65.          Visible         =   0   'False
  66.          Width           =   375
  67.       End
  68.       Begin VB.Image imgCopyButtonUp 
  69.          Height          =   330
  70.          Left            =   4560
  71.          Picture         =   "MDI.frx":05A6
  72.          Top             =   0
  73.          Visible         =   0   'False
  74.          Width           =   375
  75.       End
  76.       Begin VB.Image imgCutButtonDn 
  77.          Height          =   330
  78.          Left            =   3840
  79.          Picture         =   "MDI.frx":0788
  80.          Top             =   0
  81.          Visible         =   0   'False
  82.          Width           =   375
  83.       End
  84.       Begin VB.Image imgCutButtonUp 
  85.          Height          =   330
  86.          Left            =   3480
  87.          Picture         =   "MDI.frx":096A
  88.          Top             =   0
  89.          Visible         =   0   'False
  90.          Width           =   375
  91.       End
  92.       Begin VB.Image imgFileOpenButtonDn 
  93.          Height          =   330
  94.          Left            =   2760
  95.          Picture         =   "MDI.frx":0B4C
  96.          Top             =   0
  97.          Visible         =   0   'False
  98.          Width           =   360
  99.       End
  100.       Begin VB.Image imgFileOpenButtonUp 
  101.          Height          =   330
  102.          Left            =   3120
  103.          Picture         =   "MDI.frx":0CD6
  104.          Top             =   0
  105.          Visible         =   0   'False
  106.          Width           =   360
  107.       End
  108.       Begin VB.Image imgFileNewButtonUp 
  109.          Height          =   330
  110.          Left            =   2400
  111.          Picture         =   "MDI.frx":0E60
  112.          Top             =   0
  113.          Visible         =   0   'False
  114.          Width           =   360
  115.       End
  116.       Begin VB.Image imgFileNewButtonDn 
  117.          Height          =   330
  118.          Left            =   2040
  119.          Picture         =   "MDI.frx":0FEA
  120.          Top             =   0
  121.          Visible         =   0   'False
  122.          Width           =   375
  123.       End
  124.       Begin VB.Image imgPasteButton 
  125.          Height          =   330
  126.          Left            =   1560
  127.          Picture         =   "MDI.frx":11CC
  128.          ToolTipText     =   "Paste"
  129.          Top             =   0
  130.          Width           =   375
  131.       End
  132.       Begin VB.Image imgCopyButton 
  133.          Height          =   330
  134.          Left            =   1200
  135.          Picture         =   "MDI.frx":13AE
  136.          ToolTipText     =   "Copy"
  137.          Top             =   0
  138.          Width           =   375
  139.       End
  140.       Begin VB.Image imgCutButton 
  141.          Height          =   330
  142.          Left            =   840
  143.          Picture         =   "MDI.frx":1590
  144.          ToolTipText     =   "Cut"
  145.          Top             =   0
  146.          Width           =   375
  147.       End
  148.       Begin VB.Image imgFileOpenButton 
  149.          Height          =   330
  150.          Left            =   360
  151.          Picture         =   "MDI.frx":1772
  152.          ToolTipText     =   "Open File"
  153.          Top             =   0
  154.          Width           =   360
  155.       End
  156.       Begin VB.Image imgFileNewButton 
  157.          Height          =   330
  158.          Left            =   0
  159.          Picture         =   "MDI.frx":18FC
  160.          ToolTipText     =   "New File"
  161.          Top             =   0
  162.          Width           =   360
  163.       End
  164.    End
  165.    Begin VB.Menu mnuFile 
  166.       Caption         =   "&File"
  167.       Begin VB.Menu mnuFileNew 
  168.          Caption         =   "&New"
  169.       End
  170.       Begin VB.Menu mnuFileOpen 
  171.          Caption         =   "&Open"
  172.       End
  173.       Begin VB.Menu mnuFileExit 
  174.          Caption         =   "E&xit"
  175.       End
  176.       Begin VB.Menu mnuSeparator 
  177.          Caption         =   "-"
  178.       End
  179.       Begin VB.Menu mnuRecentFile 
  180.          Caption         =   "-"
  181.          Index           =   0
  182.          Visible         =   0   'False
  183.       End
  184.       Begin VB.Menu mnuRecentFile 
  185.          Caption         =   "RecentFile1"
  186.          Index           =   1
  187.          Visible         =   0   'False
  188.       End
  189.       Begin VB.Menu mnuRecentFile 
  190.          Caption         =   "RecentFile2"
  191.          Index           =   2
  192.          Visible         =   0   'False
  193.       End
  194.       Begin VB.Menu mnuRecentFile 
  195.          Caption         =   "RecentFile3"
  196.          Index           =   3
  197.          Visible         =   0   'False
  198.       End
  199.       Begin VB.Menu mnuRecentFile 
  200.          Caption         =   "RecentFile4"
  201.          Index           =   4
  202.          Visible         =   0   'False
  203.       End
  204.       Begin VB.Menu mnuRecentFile 
  205.          Caption         =   "RecentFile5"
  206.          Index           =   5
  207.          Visible         =   0   'False
  208.       End
  209.    End
  210.    Begin VB.Menu mnuOptions 
  211.       Caption         =   "&Options"
  212.       Begin VB.Menu mnuOptionsToolbar 
  213.          Caption         =   "&Toolbar"
  214.       End
  215.    End
  216. Attribute VB_Name = "frmMDI"
  217. Attribute VB_Base = "0{B61445CB-CA75-11CF-84BA-00AA00C007F0}"
  218. Attribute VB_Creatable = False
  219. Attribute VB_TemplateDerived = False
  220. Attribute VB_PredeclaredId = True
  221. Attribute VB_Exposed = False
  222. Attribute VB_Customizable = False
  223. '*** Main MDI form for MDI Notepad sample       ***
  224. '*** application.                               ***
  225. '**************************************************
  226. Option Explicit
  227. Private Sub imgCopyButton_Click()
  228.     ' Refresh the image.
  229.     imgCopyButton.Refresh
  230.     ' Call the copy procedure
  231.     EditCopyProc
  232. End Sub
  233. Private Sub imgCopyButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  234.     ' Show the picture for the down state.
  235.     imgCopyButton.Picture = imgCopyButtonDn.Picture
  236. End Sub
  237. Private Sub imgCopyButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  238.     ' If the button is pressed, display the up bitmap when the
  239.     ' mouse is dragged outside the button's area; otherwise
  240.     ' display the down bitmap.
  241.     Select Case Button
  242.     Case 1
  243.         If x <= 0 Or x > imgCopyButton.Width Or Y < 0 Or Y > imgCopyButton.Height Then
  244.             imgCopyButton.Picture = imgCopyButtonUp.Picture
  245.         Else
  246.             imgCopyButton.Picture = imgCopyButtonDn.Picture
  247.         End If
  248.     End Select
  249. End Sub
  250. Private Sub imgCopyButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  251.     ' Show the picture for the up state.
  252.     imgCopyButton.Picture = imgCopyButtonUp.Picture
  253. End Sub
  254. Private Sub imgCutButton_Click()
  255.     ' Refresh the image.
  256.     imgCutButton.Refresh
  257.     ' Call the cut procedure
  258.     EditCutProc
  259. End Sub
  260. Private Sub imgCutButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  261.     ' Show the picture for the down state.
  262.     imgCutButton.Picture = imgCutButtonDn.Picture
  263. End Sub
  264. Private Sub imgCutButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  265.     ' If the button is pressed, display the up bitmap when the
  266.     ' mouse is dragged outside the button's area; otherwise,
  267.     ' display the down bitmap.
  268.     Select Case Button
  269.     Case 1
  270.         If x <= 0 Or x > imgCutButton.Width Or Y < 0 Or Y > imgCutButton.Height Then
  271.             imgCutButton.Picture = imgCutButtonUp.Picture
  272.         Else
  273.             imgCutButton.Picture = imgCutButtonDn.Picture
  274.         End If
  275.     End Select
  276. End Sub
  277. Private Sub imgCutButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  278.     ' Show the picture for the up state.
  279.     imgCutButton.Picture = imgCutButtonUp.Picture
  280. End Sub
  281. Private Sub imgFileNewButton_Click()
  282.     ' Refresh the image.
  283.     imgFileNewButton.Refresh
  284.     ' Call the new file procedure
  285.     FileNew
  286. End Sub
  287. Private Sub imgFileNewButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  288.     ' Show the picture for the down state.
  289.     imgFileNewButton.Picture = imgFileNewButtonDn.Picture
  290. End Sub
  291. Private Sub imgFileNewButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  292.     ' If the button is pressed, display the up bitmap when the
  293.     ' mouse is dragged outside the button's area; otherwise,
  294.     ' display the down bitmap.
  295.     Select Case Button
  296.     Case 1
  297.         If x <= 0 Or x > imgFileNewButton.Width Or Y < 0 Or Y > imgFileNewButton.Height Then
  298.             imgFileNewButton.Picture = imgFileNewButtonUp.Picture
  299.         Else
  300.             imgFileNewButton.Picture = imgFileNewButtonDn.Picture
  301.         End If
  302.     End Select
  303. End Sub
  304. Private Sub imgFileNewButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  305.     ' Show the picture for the up state.
  306.     imgFileNewButton.Picture = imgFileNewButtonUp.Picture
  307. End Sub
  308. Private Sub imgFileOpenButton_Click()
  309.     ' Refresh the image.
  310.     imgFileOpenButton.Refresh
  311.     ' Call the file open procedure
  312.     FileOpenProc
  313. End Sub
  314. Private Sub imgFileOpenButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  315.     ' Show the picture for the down state.
  316.     imgFileOpenButton.Picture = imgFileOpenButtonDn.Picture
  317. End Sub
  318. Private Sub imgFileOpenButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  319.     ' If the button is pressed, display the up bitmap when the
  320.     ' mouse is dragged outside the button's area; otherwise,
  321.     ' display the down bitmap.
  322.     Select Case Button
  323.     Case 1
  324.         If x <= 0 Or x > imgFileOpenButton.Width Or Y < 0 Or Y > imgFileOpenButton.Height Then
  325.             imgFileOpenButton.Picture = imgFileOpenButtonUp.Picture
  326.         Else
  327.             imgFileOpenButton.Picture = imgFileOpenButtonDn.Picture
  328.         End If
  329.     End Select
  330. End Sub
  331. Private Sub imgFileOpenButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  332.     ' Show the picture for the up state.
  333.     imgFileOpenButton.Picture = imgFileOpenButtonUp.Picture
  334. End Sub
  335. Private Sub imgPasteButton_Click()
  336.     ' Refresh the image.
  337.     imgPasteButton.Refresh
  338.     ' Call the paste procedure
  339.     EditPasteProc
  340. End Sub
  341. Private Sub imgPasteButton_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
  342.     ' Show the picture for the down state.
  343.     imgPasteButton.Picture = imgPasteButtonDn.Picture
  344. End Sub
  345. Private Sub imgPasteButton_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
  346.     ' If the button is pressed, display the up bitmap when the
  347.     ' mouse is dragged outside the button's area; otherwise,
  348.     ' display the down bitmap.
  349.     Select Case Button
  350.     Case 1
  351.         If x <= 0 Or x > imgPasteButton.Width Or Y < 0 Or Y > imgPasteButton.Height Then
  352.             imgPasteButton.Picture = imgPasteButtonUp.Picture
  353.         Else
  354.             imgPasteButton.Picture = imgPasteButtonDn.Picture
  355.         End If
  356.     End Select
  357. End Sub
  358. Private Sub imgPasteButton_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
  359.     ' Show the picture for the up state.
  360.     imgPasteButton.Picture = imgPasteButtonUp.Picture
  361. End Sub
  362. Private Sub MDIForm_Load()
  363.     ' Application starts here (Load event of Startup form).
  364.     Show
  365.     ' Always set the working directory to the directory containing the application.
  366.     ChDir App.Path
  367.     ' Initialize the document form array, and show the first document.
  368.     ReDim Document(1)
  369.     ReDim FState(1)
  370.     Document(1).Tag = 1
  371.     FState(1).Dirty = False
  372.     ' Read System registry and set the recent menu file list control array appropriately.
  373.     GetRecentFiles
  374.     ' Set public variable gFindDirection which determines which direction
  375.     ' the FindIt function will search in.
  376.     gFindDirection = 1
  377. End Sub
  378. Private Sub MDIForm_Unload(Cancel As Integer)
  379.     ' If the Unload event was not cancelled (in the QueryUnload events for the Notepad forms),
  380.     ' there will be no document window left, so go ahead and end the application.
  381.     If Not AnyPadsLeft() Then
  382.         End
  383.     End If
  384. End Sub
  385. Private Sub mnuFileExit_Click()
  386.     ' End the application.
  387.     End
  388. End Sub
  389. Private Sub mnuFileNew_Click()
  390.     ' Call the new file procedure
  391.     FileNew
  392. End Sub
  393. Private Sub mnuFileOpen_Click()
  394.     ' Call the file open procedure.
  395.     FileOpenProc
  396. End Sub
  397. Private Sub mnuOptions_Click()
  398.     ' Toggle the visibility of the toolbar.
  399.     mnuOptionsToolbar.Checked = frmMDI.picToolbar.Visible
  400. End Sub
  401. Private Sub mnuOptionsToolbar_Click()
  402.     ' Call the toolbar procedure, passing a reference
  403.     ' to this form.
  404.     OptionsToolbarProc Me
  405. End Sub
  406. Private Sub mnuRecentFile_Click(index As Integer)
  407.     ' Call the file open procedure, passing a
  408.     ' reference to the selected file name
  409.     OpenFile (mnuRecentFile(index).Caption)
  410.     ' Update the list of the most recently opened files.
  411.     GetRecentFiles
  412. End Sub
  413.