frmtxt.frm

来自「如何打开运行的文本文件和图象文件」· FRM 代码 · 共 88 行

FRM
88
字号
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmTxt 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Text files"
   ClientHeight    =   4695
   ClientLeft      =   150
   ClientTop       =   435
   ClientWidth     =   5355
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4695
   ScaleWidth      =   5355
   StartUpPosition =   2  'CenterScreen
   Begin MSComDlg.CommonDialog CD 
      Left            =   3480
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      FileName        =   "c:\my documents\*.*"
      Filter          =   "All files|*.*"
   End
   Begin VB.TextBox txt 
      Height          =   3975
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Top             =   360
      Width           =   4815
   End
   Begin VB.Menu f 
      Caption         =   "&File"
      Begin VB.Menu o 
         Caption         =   "&Open"
         Shortcut        =   ^O
      End
      Begin VB.Menu s 
         Caption         =   "&Save"
         Shortcut        =   ^S
      End
      Begin VB.Menu ex 
         Caption         =   "&Exit"
      End
   End
End
Attribute VB_Name = "frmTxt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Tex As String
Dim ln As String

Private Sub ex_Click()
End
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmIntro.Show
End Sub

Private Sub o_Click()
CD.ShowOpen
frmTxt.MousePointer = 11
Open CD.FileName For Input As 1
Do Until EOF(1)
Line Input #1, ln
Tex = Tex & ln & vbCrLf
Loop
txt.Text = Tex
Close 1
frmTxt.MousePointer = 0
Tex = ""
End Sub

Private Sub s_Click()
CD.ShowSave
frmTxt.MousePointer = 11
Open CD.FileName For Output As 1
Print #1, txt.Text
Close 1
frmTxt.MousePointer = 0
End Sub

⌨️ 快捷键说明

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