?? form6.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form6
Caption = "文本編輯器"
ClientHeight = 6105
ClientLeft = 60
ClientTop = 450
ClientWidth = 6795
LinkTopic = "Form6"
ScaleHeight = 6105
ScaleWidth = 6795
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "退出"
Height = 495
Index = 5
Left = 5280
TabIndex = 7
Top = 5040
Width = 975
End
Begin VB.CommandButton Command1
Caption = "關閉"
Height = 495
Index = 4
Left = 5280
TabIndex = 6
Top = 4320
Width = 975
End
Begin VB.CommandButton Command1
Caption = "另存"
Height = 495
Index = 3
Left = 5280
TabIndex = 5
Top = 3600
Width = 975
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 495
Index = 2
Left = 5280
TabIndex = 4
Top = 2880
Width = 975
End
Begin VB.CommandButton Command1
Caption = "打開"
Height = 495
Index = 1
Left = 5280
TabIndex = 3
Top = 2160
Width = 975
End
Begin VB.CommandButton Command1
Caption = "新建"
Height = 495
Index = 0
Left = 5280
TabIndex = 2
Top = 720
Width = 975
End
Begin VB.TextBox Text1
Height = 5895
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 120
Width = 4575
End
Begin VB.PictureBox Picture1
Align = 4 'Align Right
Height = 6105
Left = 4860
ScaleHeight = 6045
ScaleWidth = 1875
TabIndex = 0
Top = 0
Width = 1935
Begin VB.CommandButton Command2
Caption = "字體"
Height = 495
Left = 360
TabIndex = 8
Top = 1440
Width = 975
End
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2520
Top = 5640
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = "*.*|*.txt|*.TXT|*.Txt"
FilterIndex = 2
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click(Index As Integer)
n = Index
Select Case n
Case 0:
Text1.Text = ""
Form6.Caption = "未命名"
Case 1:
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
CommonDialog1.ShowOpen '顯示打開對話框
fname = CommonDialog1.FileName
If fname <> "" Then
Text1.Text = ""
Open fname For Input As #1
b = ""
Do Until EOF(1)
Line Input #1, nextline
b = b & nextline & Chr(13) & Chr(10)
Loop
Close #1
Text1.Text = b
End If
Form6.Caption = fname
Case 2:
If Form6.Caption = "文本編輯器" Or Form6.Caption = "未命名" Or Form6.Caption = "" Then
CommonDialog1.ShowSave '顯示另存為對話框
fname = CommonDialog1.FileName
Else
fname = Form6.Caption
End If
If fname <> "" Then
Open fname For Output As #1
Print #1, Text1.Text
Close #1
End If
Case 3:
CommonDialog1.ShowSave
fname = CommonDialog1.FileName
If fname <> "" Then
Open fname For Output As #1
Print #1, Text1.Text
Close #1
End If
Case 4:
Text1.Text = ""
Form1.Show
Form6.Hide
Case 5:
Text1.Text = ""
End
End Select
End Sub
Private Sub Command2_Click()
'將 Cancel 設置成 True。
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
'設置 Flags 屬性。
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
'顯示“字體”對話框。
CommonDialog1.ShowFont
'根據用戶的選擇來設置文本屬性。
Text1.Font.Name = CommonDialog1.FontName
Text1.Font.Size = CommonDialog1.FontSize
Text1.Font.Bold = CommonDialog1.FontBold
Text1.Font.Italic = CommonDialog1.FontItalic
Text1.Font.Underline = CommonDialog1.FontUnderline
Text1.FontStrikethru = CommonDialog1.FontStrikethru
Text1.ForeColor = CommonDialog1.Color
Exit Sub
ErrHandler:
'用戶按了“取消”按鈕。
Exit Sub
End Sub
Private Sub Form_Resize() '為了使改變窗體大小的時候文本框能隨之改變
With Text1
.Left = 0
.Top = 0
.Height = Form6.ScaleHeight
.Width = Form6.ScaleWidth - Picture1.Width
End With
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -