⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdiform1.frm

📁 用VB编程实现word的基本功能
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.MDIForm MDIForm1 
   BackColor       =   &H8000000C&
   Caption         =   "MDIForm1"
   ClientHeight    =   3195
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   7290
   LinkTopic       =   "MDIForm1"
   StartUpPosition =   3  '窗口缺省
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   615
      Left            =   0
      TabIndex        =   1
      Top             =   2580
      Width           =   7290
      _ExtentX        =   12859
      _ExtentY        =   1085
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Text            =   "Current Status"
            TextSave        =   "Current Status"
            Key             =   " Status"
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   1
            Alignment       =   1
            AutoSize        =   1
            Enabled         =   0   'False
            TextSave        =   "CAPS"
            Key             =   "CAPS"
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   3
            Alignment       =   1
            AutoSize        =   1
            Enabled         =   0   'False
            TextSave        =   "Ins"
            Key             =   "INS"
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   6
            Alignment       =   1
            AutoSize        =   1
            TextSave        =   "2005-9-8"
            Key             =   "Date"
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Style           =   5
            Alignment       =   1
            AutoSize        =   1
            TextSave        =   "9:10"
            Key             =   "time"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   1200
      Top             =   1200
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   11
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0112
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0224
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0336
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0448
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":055A
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":066C
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":077E
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0890
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":09A2
            Key             =   ""
         EndProperty
         BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":0AB4
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   420
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7290
      _ExtentX        =   12859
      _ExtentY        =   741
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      ImageList       =   "ImageList1"
      HotImageList    =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   14
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "新建"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "保存"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "打开"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "剪切"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "复制"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "粘贴"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "撤消删除"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            ImageIndex      =   8
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "中对齐"
            ImageIndex      =   9
         EndProperty
         BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "右对齐"
            ImageIndex      =   10
         EndProperty
         BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.ToolTipText     =   "左对齐"
            ImageIndex      =   11
         EndProperty
      EndProperty
      Begin VB.ComboBox cmFontSize 
         Height          =   300
         Left            =   9840
         TabIndex        =   3
         Top             =   0
         Width           =   855
      End
      Begin VB.ComboBox cmFontName 
         Height          =   300
         ItemData        =   "MDIForm1.frx":0BC6
         Left            =   8040
         List            =   "MDIForm1.frx":0BC8
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   0
         Width           =   1245
      End
   End
   Begin VB.Menu mnufile 
      Caption         =   "文件(&F)"
      Begin VB.Menu mnufilenew 
         Caption         =   "新建(&N)"
      End
      Begin VB.Menu mnufileopen 
         Caption         =   "打开(&O)"
      End
      Begin VB.Menu mnufileclose 
         Caption         =   "关闭(&C)"
      End
      Begin VB.Menu mnufilediv 
         Caption         =   "-"
      End
      Begin VB.Menu mnufilesave 
         Caption         =   "保存(&S)"
      End
      Begin VB.Menu mnufilediv1 
         Caption         =   "-"
      End
      Begin VB.Menu mnufileexit 
         Caption         =   "退出(&X)"
      End
   End
   Begin VB.Menu mnuedit 
      Caption         =   "编辑(&E)"
      Begin VB.Menu undo 
         Caption         =   "撤消"
      End
      Begin VB.Menu redo 
         Caption         =   "恢复"
      End
      Begin VB.Menu mnueditcut 
         Caption         =   "剪切(&T)"
         Shortcut        =   ^X
      End
      Begin VB.Menu mnueditcopy 
         Caption         =   "复制(&C)"
         Shortcut        =   ^C
      End
      Begin VB.Menu mnueditpaste 
         Caption         =   "粘贴(&P)"
         Shortcut        =   ^V
      End
   End
   Begin VB.Menu format 
      Caption         =   "格式(&O)"
      Begin VB.Menu font 
         Caption         =   "字体(&F)"
      End
      Begin VB.Menu color 
         Caption         =   "颜色(&C)"
      End
   End
   Begin VB.Menu table 
      Caption         =   "表格(&A)"
      Begin VB.Menu writetable 
         Caption         =   "绘制表格(&W)"
      End
   End
   Begin VB.Menu formarrange 
      Caption         =   "窗口(&F)"
      Begin VB.Menu mnuhorizontal 
         Caption         =   "水平平铺(&H)"
      End
      Begin VB.Menu mnuvertical 
         Caption         =   "垂直平铺(&V)"
      End
      Begin VB.Menu mnucascade 
         Caption         =   "层叠(&C)"
      End
   End
   Begin VB.Menu mnupopedit 
      Caption         =   ""
      Visible         =   0   'False
      Begin VB.Menu mnupopeditcut 
         Caption         =   "剪切(&T)"
      End
      Begin VB.Menu mnupopeditcopy 
         Caption         =   "复制(&C)"
      End
      Begin VB.Menu mnupopeditpaste 
         Caption         =   "粘贴(&P)"
      End
   End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public textchanged As Boolean
Private Sub newdocfrm()
   Static documentnum As Integer
   Dim frmdoc As New frmdocument
   documentnum = documentnum + 1
   frmdoc.Caption = "文档" & documentnum
   frmdoc.Show
frmdoc.WindowState = vbMaximized
End Sub
Private Sub color_Click()
Call ActiveForm.diaoyong2
End Sub
Private Sub font_Click()
Call ActiveForm.diaoyong1
End Sub
Private Sub MDIForm_Load()
 MDIForm1.WindowState = vbMaximized
Call newdocfrm
MDIForm1.textchanged = False
For i = 0 To Screen.FontCount - 1
      cmFontName.AddItem Screen.Fonts(i)
    Next i
    cmFontName.ListIndex = 0
    For i = 8 To 72 Step 2
      cmFontSize.AddItem i
    Next i
    cmFontSize.ListIndex = 2
    undo = False
     undo.Enabled = False
    Toolbar1.Buttons(5).Enabled = False
    Toolbar1.Buttons(6).Enabled = False
   mnupopeditcut.Enabled = False
   mnupopeditcopy.Enabled = False
End Sub
Private Sub mnucascade_Click()
Me.Arrange vbCascade
End Sub
Private Sub mnuEditCopy_Click()
Clipboard.SetText ActiveForm.ActiveControl.SelRTF
If Clipboard.GetFormat(vbCFText) Then
 mnueditpaste.Enabled = True
 Toolbar1.Buttons(6).Enabled = True
  Else
 mnueditpaste.Enabled = False
 Toolbar1.Buttons(6).Enabled = False
 End If
End Sub
Private Sub mnuEditCut_Click()
Clipboard.SetText ActiveForm.ActiveControl.SelRTF
ActiveForm.ActiveControl.SelRTF = ""
If Clipboard.GetFormat(vbCFText) Then
 mnueditpaste.Enabled = True
 Toolbar1.Buttons(6).Enabled = True
 Else
 mnueditpaste.Enabled = False
 Toolbar1.Buttons(6).Enabled = False
 End If
End Sub
Private Sub mnuEditPaste_Click()
ActiveForm.ActiveControl.SelRTF = Clipboard.GetText
End Sub
Private Sub mnuFileClose_Click()
On Error Resume Next
Unload ActiveForm
End Sub
Private Sub mnuFileExit_Click()
If textchanged = True Then
Call tc
End If
End
End Sub
Private Sub mnuFileNew_Click()
If textchanged = True Then
Call tc
End If
Call newdocfrm
End Sub
Private Sub mnuFileOpen_Click()
If textchanged = True Then
Call tc
End If
Call ActiveForm.dk
End Sub
Private Sub mnuFileSave_Click()
Call ActiveForm.bc
End Sub
Private Sub mnuhorizontal_Click()
Me.Arrange vbTileHorizontal
End Sub
Private Sub mnuvertical_Click()
Me.Arrange vbTileVertical
End Sub
Private Sub redo_Click()
If undo = False Then
              undo_Click
            End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
i = Button.Index
Select Case i
Case 1
mnuFileNew_Click
Case 2
 mnuFileSave_Click
Case 3
 mnuFileOpen_Click
Case 5
 mnuEditCut_Click
Case 6
mnuEditCopy_Click
Case 7
mnuEditPaste_Click
Case 9
undo_Click
Case 10
redo_Click
Case 12
ActiveForm.text1.SelAlignment = rtfCenter
Case 13
 ActiveForm.text1.SelAlignment = rtfLeft
Case 14
   ActiveForm.text1.SelAlignment = rtfRight
End Select
End Sub
Sub tc()
Dim tui As Integer
tui = MsgBox("文件已被修改,是否保存?", vbYesNo Or vbQuestion, "警告")
If tui = 6 Then
Call ActiveForm.bc
End If
End Sub
Private Sub mnupopeditcopy_Click()
mnuEditCopy_Click
End Sub
Private Sub mnupopeditcut_Click()
mnuEditCut_Click
End Sub
Private Sub mnupopeditpaste_Click()
mnuEditPaste_Click
End Sub
Private Sub undo_Click()
Dim ls As String
  ls = SendMessage(ActiveForm.text1.hwnd, &HC7, 0, 0)
   ActiveForm.text1.SetFocus
     undo = Not (undo)
End Sub
Private Sub writetable_Click()
Static documentnum As Integer
   Dim frmdoc As New table
   documentnum = documentnum + 1
   frmdoc.Caption = "表格" & documentnum
   frmdoc.Show
End Sub
Private Sub cmFontName_click()
  Startsel = ActiveForm.text1.SelStart
  Length = Len(ActiveForm.text1.SelText)
  ActiveForm.text1.SelFontName = cmFontName.Text
  End Sub
Private Sub cmFontSize_click()
      Startsel = ActiveForm.text1.SelStart
   Length = Len(ActiveForm.text1.SelText)
  ActiveForm.text1.SelFontSize = cmFontSize.Text
  End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -